|
|
| Author |
Message |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3913
Location: Australia
|
Posted: April 21st 2009, 1:20 am Post subject: Writing hacks in MODX format |
|
|
Can someone please give me a tutorial on how to write hacks using the phpBB3 MODX .xml files?
I have spent many hours searching phpbb.com and googling but I have yet to find instructions on how to create a MODX hack. _________________ ~HG~
|| rodneyangell.com || || phpbb-tutorials.com ||My Hacks |
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3913
Location: Australia
|
Posted: April 21st 2009, 10:50 pm Post subject: |
|
|
Thats the first place I looked Patrick.
There is plenty on how to install MODX files but nothing that I can find in relation to writing hacks in .xml format so hopefully one of our own hack authors will be kind enough to put together an easy to follow tutorial so that novice's like myself and other's can interpret and use as part of our knowledge of phpbb. _________________ ~HG~
|| rodneyangell.com || || phpbb-tutorials.com ||My Hacks |
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3913
Location: Australia
|
|
| Back to top |
|
 |
Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
MilkHub
New User
Joined: 21 Apr 2009
Posts: 13
Location: England
|
Posted: April 23rd 2009, 10:25 am Post subject: |
|
|
I think the most useful things you can get from phpbb.com are the "Sample MODX File" (below "files" on the above linked page) and then the "Format Description" on the left of that too.
If you view the source of the Sample MODX file you'll see they've created a simple template with the most common actions you'll need in your mod. You can then use the format description as a complete reference of everything you can do... it's not the easiest document to read but once had a look through the sample it should make a bit more sense.
If you've looked through both of those and cannot see how to get started perhaps you could ask some more directed questions to get the ball rolling? _________________ My Mods | Moderator CP |
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3913
Location: Australia
|
Posted: April 23rd 2009, 10:48 am Post subject: |
|
|
Thanks MilkHub.
I have been through those 2 listed before as well as everything else on phpbb.com, all of which seem to be aimed at the end user (ie, the person installing the mod) and yet there does not appear to be anything at all directed to the mod author particularly in how to write a modx file.
In the FAQ on MODX at phpbb.com there is this question and answer;
| Quote:
|
Can I write MODX by hand?
Yes, there is a tutorial on how to write MODX by hand. The process should be familiar to anyone who has ever written HTML by hand.
|
The word tutorial is a link however it takes you back to the ModX resource centre page where there is no tutorial that I can find on writing a ModX file.
There is of course the Quickstart files which includes the licence and .xsl file which must be included but there is definetly no tutorial on writing the MODX file itself other than the sample. _________________ ~HG~
|| rodneyangell.com || || phpbb-tutorials.com ||My Hacks |
|
| Back to top |
|
 |
lefty74
Well Known User
Joined: 13 Feb 2006
Posts: 146
|
|
| Back to top |
|
 |
~HG~
Dedicated User
Joined: 08 Nov 2003
Posts: 3913
Location: Australia
|
Posted: April 23rd 2009, 9:56 pm Post subject: |
|
|
Very familiar with the .txt format lefty but that doesn't help me with the MODX setup.
I can follow and understand everything on phpbb.com about MODX. That's easy enough. But where do you start in setting up the .xml page etc ???
Here I have changed your .xml file for Avatar in Who Is Online mod to .txt and this gives me the best indication yet.
I no doubt could edit your file with my own info and save it as an .xml file and I dare say that would work. Messy naturally, but I am sure I would be right in doing it that way. So I think there must be an easier way than that.
| Code:
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="modx.prosilver.en.xsl"?>
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.0.1.xsd">
<header>
<license>http://opensource.org/licenses/gpl-license.php GNU General Public License v2</license>
<title lang="en-gb">Avatar in Who is Online</title>
<description lang="en-gb">Shows the Avatar of users in the Who is online page
</description>
<author-notes lang="en-gb">Another avatar mod :P
</author-notes>
<author-group>
<author>
<realname>Heiko Carstens</realname>
<email>lefty@lefty74.com</email>
<username>lefty74</username>
<homepage>http://www.lefty74.com</homepage>
<contributions />
</author>
</author-group>
<mod-version>
<major>1</major>
<minor>0</minor>
<revision>0</revision>
</mod-version>
<installation>
<level>easy</level>
<time>519</time>
<target-version>
<target-primary>3.0</target-primary>
<target-major allow="exact">2</target-major>
<target-minor allow="exact">0</target-minor>
</target-version>
</installation>
<history>
<entry>
<date>2007-07-22</date>
<rev-version>
<major>0</major>
<minor>0</minor>
<revision>1</revision>
</rev-version>
<changelog lang="en-gb">
<change>Initial release</change>
</changelog>
</entry>
<entry>
<date>2007-07-29</date>
<rev-version>
<major>0</major>
<minor>0</minor>
<revision>1</revision>
<release>a</release>
</rev-version>
<changelog lang="en-gb">
<change>made RC4 compliant</change>
</changelog>
</entry>
<entry>
<date>2007-10-28</date>
<rev-version>
<major>0</major>
<minor>0</minor>
<revision>1</revision>
<release>b</release>
</rev-version>
<changelog lang="en-gb">
<change>made RC7 compliant</change>
</changelog>
</entry>
<entry>
<date>2008-01-14</date>
<rev-version>
<major>0</major>
<minor>0</minor>
<revision>2</revision>
</rev-version>
<changelog lang="en-gb">
<change>resizes avatar to a max width/height</change>
</changelog>
</entry>
<entry>
<date>2008-03-02</date>
<rev-version>
<major>1</major>
<minor>0</minor>
<revision>0</revision>
</rev-version>
<changelog lang="en-gb">
<change>repackaged for submission to MODDB</change>
</changelog>
</entry>
</history>
<meta name="generator" content="Phpbb.ModTeam.Tools (c#)" />
</header>
<action-group>
<open src="viewonline.php">
<edit>
<find>include($phpbb_root_path . 'common.' . $phpEx);
</find>
<action type="after-add">include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
</action>
</edit>
<edit>
<find>// Get user list
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_type, u.user_colour,</find>
<inline-edit>
<inline-find> u.user_colour,</inline-find>
<inline-action type="after-add"> u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, </inline-action>
</inline-edit>
</edit>
<edit>
<find><![CDATA[ $template->assign_block_vars('user_row', array(]]></find>
<action type="before-add"><![CDATA[ $avatar_max_dimensions = $avatar_width = $avatar_height = '';
if ( !empty($row['user_avatar']) )
{
$avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed, change to 0 to use default
if ( $avatar_max_dimensions )
{
if ( $row['user_avatar_width'] >= $row['user_avatar_height'] )
{
$avatar_width = ( $row['user_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['user_avatar_width'] ;
$avatar_height = ( $avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['user_avatar_width'] * $row['user_avatar_height']) : $row['user_avatar_height'] ;
}
else
{
$avatar_height = ( $row['user_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['user_avatar_height'] ;
$avatar_width = ( $avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['user_avatar_height'] * $row['user_avatar_width']) : $row['user_avatar_width'] ;
}
}
else
{
$avatar_height = $row['user_avatar_height'];
$avatar_width = $row['user_avatar_width'];
}
}]]></action>
</edit>
<edit>
<find><![CDATA[ 'USERNAME' => $row['username'],
]]></find>
<action type="after-add"><![CDATA[ 'ONLINE_AVATAR' => ( $row['user_avatar'] ) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $avatar_width, $avatar_height) : '',
]]></action>
</edit>
</open>
<open src="styles/prosilver/template/viewonline_body.html">
<edit>
<find><![CDATA[ <th class="name"><a href="{U_SORT_USERNAME}">{L_USERNAME}</a></th>]]></find>
<action type="before-add"><![CDATA[ <th> </th>]]></action>
</edit>
<edit>
<find><![CDATA[ <td>{user_row.USERNAME_FULL}<!-- IF user_row.USER_IP --> <span style="margin-left: 30px;">{L_IP}:
]]></find>
<action type="before-add"><![CDATA[ <td style="width:20px;"><!-- IF user_row.ONLINE_AVATAR -->{user_row.ONLINE_AVATAR}<!-- ENDIF --></td>]]></action>
</edit>
<edit>
<find><![CDATA[ <td colspan="{%:1}">{L_NO_ONLINE_USERS}<!-- IF S_SWITCH_GUEST_DISPLAY --> • <a href="{U_SWITCH_GUEST_DISPLAY}">{L_SWITCH_GUEST_DISPLAY}</a><!-- ENDIF --></td>
]]></find>
<action type="operation">%:1</action>
</edit>
</open>
</action-group>
</mod>
|
_________________ ~HG~
|| rodneyangell.com || || phpbb-tutorials.com ||My Hacks |
|
| Back to top |
|
 |
|