Italian SMF

Tutto su SMF => Guide - Trucchi => Discussione aperta da: Darknico il Lunedì - 25 Febbraio 2013 - 12:14

Titolo: Installazione di una mod a mano
Inserito da: Darknico il Lunedì - 25 Febbraio 2013 - 12:14
Le mod solitamente sono progettate per lavorare con il tema di default,ovvero il tema "base".
E' difficile per chi crea le Mod, tanto quanto è difficile per chi crea i temi, far si che le mod lavorino con ogni tema.
Comunque è possibile installare una Mod manualmente, adattandola così ad ogni tema.

Mi Raccomando!Leggete tutto prima di incominciare a fare le modifiche a mano, risparmieremo così molte domande dopo...

Scompattiamo la mod,e andiamo subito a cercare il file package-info.xml
Questo file contiene tutte le informazioni per far eseguire la mod: quali file aggiungere, quale file fa le modifiche, quale file esegue query al database, e altre informazioni....

<install for="..."> indica per quale versione è la mod(se nn ce scritto niente non controlla la versione)
<require-file name="..." destination="..." /> nome del file da inserire in una determinata posizione
<require-dir name="..." destination="..." /> nome della cartella da inserire in una determinata posizione
<code >...< /code> file che esegue le query al database
<modification>...</modification> il file più importante;
ora andremo ad analizzare questo file che eseguirà tutte le modifiche al nostro smf



Ecco un esempio:

<edit file>
Themes/default/Display.template.php
</edit file>

<search>
// Show the anchor for the top and for the first message.  If the first message is new, say so.
</search>

<replace>
global $bar_exps, $bar_posts;

// Show the anchor for the top and for the first message.  If the first message is new, say so.
</replace>


Questo significa che dobbiamo aprire il file Display.template.php e cercare:

// Show the anchor for the top and for the first message.  If the first message is new, say so.

E sostituirlo con:

global $bar_exps, $bar_posts;

// Show the anchor for the top and for the first message.  If the first message is new, say so.





Prima ho detto che l'estensione .mod non viene piu usata(anche se alcune le potete trovare ancora così) ma si usa .xml
Il procedimento è uguale,cambia solo per alcune cose:

Ecco quindi come si presenterebbe la mod di prima con il metodo .xml


<file name="$themedir/Display.template.php">
<operation>
<search position="replace"><![CDATA[ // Show the anchor for the top and for the first message.  If the first message is new, say so.]]></search>
<add><![CDATA[ global $bar_exps, $bar_posts;

// Show the anchor for the top and for the first message.  If the first message is new, say so.
]]></add>
</operation>
</file>


Come potete vedere il funzionamento è lo stesso

Esistono poi variabili o azioni speciali  tipo queste:




Questo è tutto,ora dovreste essere in grado di installare una mod manualmente, sia se lo vogliate fare, sia se volete adattare ad un vostro tema.

N.B. non dovete mai modificare la mod,ma direttamente i vostri file!!

Un piccolo consiglio
se dovete solo adattare ad un vostro tema agite in questo mod:

vi ricordo infatti ke ogni tema che installate non contiene tutti i file ma solo quelli che servono, quindi in caso manchi qualche file automaticamente va ad usare quello del default che la mod ha gia ovviamente modificato precedentemente.

Detto questo,buona modifica!!!





per chi ha difficoltà ad aprire le mod e seguire le modiffiche, è disponibile il parser nel sito ufficiale, per qualsiasi mod