Hook replace (deprecated)

From Sohowiki
Revision as of 18:17, 18 May 2006 by 70.155.66.187 (Talk)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
Syntax
hook_replace(source file name, replacement manifest file name)
Description
Reads your replacement manifest file and replaces specified chunk(s) of code in source file with your different (modified) code.

Specific replacements for a particular source file should be placed in a dedicated file (this is your replacement manifest).


Example 1 - Calling hook_replace from your plugin's install manifest

hook_replace("sohoadmin/program/main_menu.php", "main_menu-replacements.php");


Example 2 - Content of replacement manifest file (main_menu-replacements.php)


#new replacement#
# Add another title row below the "Basic Features Group" row.
<oldcode>
    <tr>
     <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
    </tr>
</oldcode>

<newcode>
    <tr>
     <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
    </tr>
    <tr>
     <td class="fgroup_title">Hello World!</td>
    </tr>
</newcode>

#new replacement#
# Replace title row with modifed version
<oldcode>
    <tr>
     <td class="fgroup_title"><? echo lang("Basic Features Group"); ?></td>
    </tr>
</oldcode>

<newcode>
    <tr>
     <td class="fgroup_title" style="font-style: italic;">Hello World!</td>
    </tr>
</newcode>
Personal tools