En este tuto vamos a aprender a:
1 Las variables obligatorias para crear un MOD como search position, CDATA ...
2 Creando Un Mod.
--------------------------------------------------------------------------------------------------------
Bueno vamos a empezar.
1 Las variables.
<id> = la variable <id> es para clasificar... pon ahi tu usuario y mod quedaria asi: <id>tuusuario:TuMOD</id>
<version> = sirve para obtener la versión de tu Mod, por ejemplo puedes poner <version>1.00</version>
<edit file> = sirve para indicar el archivo que se va a editar por ejemplo: <edit file>
$themedir/Register.template.php
</edit file>
$dir = Las direcciones se pueden indicar así, entre otras:
$sourcedir = La carpeta sources
$themedir = La carpeta themes
<search for> = Sirve para dar la orden de buscar algo ... por ejemplo:
<search for>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';
</search for>
<add before> = Añadir algo después del texto buscado, esto va despues de la variable search...
<add before>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>
</add before><add after> = Añadir antes del texto buscado, esto va despues de la variable search...
<add after>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>
</add after><replace> = Remplazar el texto buscado, esto va despues de la variable search ...
<replace>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>
</replace>
2 Creando un Mod:
Pues con todo lo aprendido podríamos juntarlo ... Para el ejemplo de un mod creado he puesto el de elejir el lenguaje en el registro, creado por mí.
1 Tendríamos que crear 2 archivos (para este Mod) Uno llamado por ejemplo Install.mod Y otro package-info.xml.
2 Tendríamos que poner en el Install.mod La <id> de nuestro Mod quedaría asi:
<id>
edurg:LangRegistration
</id>
Luego pondríamos la versión de nuestro Mod y quedaría asi:
<id>
edurg:LangRegistration
</id>
<version>
1.2.1
</version>
Después agregaríamos el archivo a editar y quedaría.. :
<id>
edurg:LangRegistration
</id>
<version>
1.2.1
</version>
<edit file>
$themedir/Register.template.php
</edit file>
Luego meteríamos la variable search for para buscar el texo que queramos remplazar o agregar texto después de ese y quedaría asi:
<id>
edurg:LangRegistration
</id>
<version>
1.2.1
</version>
<edit file>
$themedir/Register.template.php
</edit file>
<search for>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';
</search for>
Luego pondríamos si queremso remplazar, añadir despues el texto o antes y quedaría:
<id>
edurg:LangRegistration
</id>
<version>
1.2.1
</version>
<edit file>
$themedir/Register.template.php
</edit file>
<search for>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';
</search for>
<replace>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>
</replace>
Y repetimos los pasos de buscar y añadir o remplazar para hacer mas modificaciones y ya tendríamos hecho el Install.mod:
<id>
edurg:LangRegistration
</id>
<version>
1.2.1
</version>
<edit file>
$themedir/Register.template.php
</edit file>
<search for>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>';
</search for>
<replace>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" tabindex="', $context['tabindex']++, '" />
</td>
</tr>
</replace>
<edit file>
$themedir/Register.template.php
</edit file>
<search for>
if ($context['visual_verification'])
{
echo '
<tr valign="top">
</search for>
<add before>
<td width="40%">
<b>', $txt[1000], ':</b>
</td>
<td>
<select name="lngfile">';
foreach($context['languages'] as $language)
echo '
<option value="', $language['filename'], '">', $language['name'], '</option>';
echo '</select>
</td>
</tr>';
</add before>
<edit file>
$languagedir/index.spanish.php
</edit file>
<search for>
$txt[40] = 'Nombre de usuario no existente.';
</search for>
<add before>
$txt[1000] = 'Elija el idioma';
</add before>
<edit file>
$languagedir/index.turkish.php
</edit file>
<search for>
$txt[22] = 'Son mesaj';
</search for>
<add before>
$txt[1000] = 'Dil seçin';
</add before>
<edit file>
$languagedir/index.english.php
</edit file>
<search for>
$txt[151] = 'No messages...';
</search for>
<add before>
$txt[1000] = 'Choose the language ';
</add before>
Y ahora solo nos falta el package-info.xml, así que manos a la obra.
Ponemos la versión del xml y el Tipo de Doc...
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
Después pondríamos el nombre de usuario y el mod + unas cosas mas ...
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>edurg:LanguageOnRegistration</id>
Luego pondríamos el nombre, versión y tipo:
<name>Lenguaje en el registro</name>
<version>1.2.4</version>
<type>modification</type>
Después agregaríamos para que versiones se va a instalar y el readme del Mod:
<install for="1.1 RC2, 1.1 RC3, 1.1, 1.1.1-1.1.2">
<readme type="inline">
Version 1.1+ Install
Este Mod Añade El lenguage en el registro...
Copyright 2007 by edurg @ www.forodescarga.com
</readme>
Luego el formato de la instalación y cerramos el install con un </INSTALL> ...
<modification format="boardmod">Install.mod</modification>
</install>
Esta vez es la desistalación y ponemos para que se va a desisntalar (Poner lo mismo de lo que se instala) y el formato de la modificación Y la finalización del documento (</package-info>)..
<uninstall for="1.1 RC2, 1.1 RC3, 1.1, 1.1.1-1.1.2">
<modification format="boardmod" reverse="true">Install.mod</modification>
</uninstall>
</package-info>
Y todo Junto quedaría asi:
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>edurg:LanguageOnRegistration</id>
<name>Lenguaje en el registro</name>
<version>1.2.4</version>
<type>modification</type>
<install for="1.1 RC2, 1.1 RC3, 1.1, 1.1.1-1.1.2">
<readme type="inline">
Version 1.1+ Install
Este Mod Añade El lenguage en el registro...
Copyright 2007 by edurg @ www.forodescarga.com
</readme>
<modification format="boardmod">Install.mod</modification>
</install>
<uninstall for="1.1 RC2, 1.1 RC3, 1.1, 1.1.1-1.1.2">
<modification format="boardmod" reverse="true">Install.mod</modification>
</uninstall>
</package-info>
Y luego solo quedaría hacer un .zip con el winrar sería asi:
Seleccionas los archivos creados, Le das con el botón derecho y le das a añadir al archivo ... Y elijes .zip (Rar no lo soporta el manejador de paquetes) Y ya tenes creado el Mod.
Espero que le hayan servido ya postearé mas y mejores, cualquier duda en este post ...
Saludos!