Sohowiki Sandbox

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
(hook_replace)
(Affiliate link test: commented out affiliate link and heading)
 
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup.
 
Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup.
  
==hook_attach==
+
<!--==Affiliate link test==
hook_attach(plugin file, hook id name)
+
http://addons.soholaunch.com/?partner=7-->
  
 
+
==Test Main Page layout==
'''Description'''<br>
+
{| width="100%" cellpadding="5" cellspacing="5"
Includes (attaches) your custom script (plugin file) at a pre-designated place (hook id) in the Pro Edition source code.
+
| width="50%" style="font-size: 95%;background-color: #f8f9fd; border: 1px solid #d9e6ef;vertical-align: top;"|
 
+
{| style="background-color: #f8f9fd;"
 
+
! <h2 style="margin:0;background-color:#a5c6e6;font-size:120%;font-weight:bold;border:1px solid #a3b0bf;text-align:left;color:#000;padding:0.2em 0.4em;">Welcome</h2>
'''Example 1 - What a designated hook looks like in the Pro Edition source code'''<br>
+
|-
''Taken from in sohoadmin/program/header.php (~line #375 as of v4.9 Beta2)''
+
| We've set up this site to act as a central knowledgebase for all things Soholaunch. At this point, the site's still a baby, with only a few scattered pages of content, so if you're just browsing for an answer, solution, etc. to specific question/problem you have, then you'll probably have better luck searching the [[http://forum.soholaunch.com Soholaunch Community Forum]] or even the regular [http://manual.soholaunch.com User's Manual]. And hey, if you do find your answer on the forums, maybe you could come back to this site and write a quick tip/article about it... you could even include a little "this tip/article brought to you by..." blurb with a link to your company website...
<pre>eval(hook("header.php:top_javascript", basename(__FILE__)));</pre>
+
|-
 
+
|'''Note:''' This is not meant to replace the standard [http://manual.soholaunch.com User's Manual]. We (Soholaunch) created it because we wanted a place to quickly post random/specialized information (i.e. installation troubleshooting, customization tricks, etc) without having to stop and think about private-branding issues or whether it might be so specialized (only relavant to a small minority) that it's existence might end up confusing more people than it helps.
 
+
|}
'''Example 2 - calling hook attachement() from your install_manifest.php'''<br>
+
| width="50%" style="background-color: #f8fdfb; border: 1px solid #dff6ea;vertical-align: top;"|
''Taken from QuickEdit Dropdown Menu plugin''
+
{| width="100%" style="background-color: #f8fdfb;"
<pre>hook_attach("quickedit_js.php", "header.php:top_javascript");</pre>
+
!<h2 style="margin:0;background-color:#a5e6b3;font-size:120%;font-weight:bold;border:1px solid #a3b0bf;text-align:left;color:#000;padding:0.2em 0.4em;">Latest Updates</h2>
 
+
|-
 
+
|
The end-result of examples 1 and 2 is that Pro Edition will include() your script at the designated location (determined by hook id). So when Pro Edition processes header.php and gets to that line with a hook() on it that your plugin has attached to (by calling hook_attach in its install_manifest.php), it basically does this...
+
*Working changelog started for upcoming v4.9 r21
<pre>include("[path_your_plugin_folder]/quickedit_js.php");</pre>
+
*New main page for wiki!
 
+
*New troubleshooting tip on free trial period
==hook_overwrite==
+
|-
hook_overwrite(source file name, plugin file name)
+
|<h2 style="margin:0;background-color:#a5e6b3;font-size:120%;font-weight:bold;border:1px solid #a3b0bf;text-align:left;color:#000;padding:0.2em 0.4em;">Quick Links</h2>
 
+
*[[Special:Popularpages|Most popular pages]]
'''Description'''<br>
+
*[[Custom_Templates|Custom template specs]]
Completely overwrites a source file with the file you specify.
+
|}
 
+
|}
Original source file is renamed to filename.php-[plugin_folder_name]
+
 
+
 
+
'''Example 1 - calling hook_overwrite from your install_manifest.php'''
+
<pre>hook_overwrite("sohoadmin/program/main_menu.php", "your_modded_main_menu.php");</pre>
+
 
+
==hook_replace==
+
hook_replace(source file name, replacement manifest file name)
+
 
+
'''Description'''<br>
+
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'''
+
<pre>hook_replace("sohoadmin/program/main_menu.php", "main_menu-replacements.php");</pre>
+
 
+
 
+
'''Example 2 - Content of replacement manifest file (main_menu-replacements.php)'''
+
 
+
<pre>
+
 
+
#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>
+
</pre>
+

Latest revision as of 15:38, 22 October 2014

Write now, organize and place later. This is the place to draft content before you know exactly where it should go...also good place for expermimenting with wiki markup.


Contents

Test Main Page layout

Welcome

We've set up this site to act as a central knowledgebase for all things Soholaunch. At this point, the site's still a baby, with only a few scattered pages of content, so if you're just browsing for an answer, solution, etc. to specific question/problem you have, then you'll probably have better luck searching the [Soholaunch Community Forum] or even the regular User's Manual. And hey, if you do find your answer on the forums, maybe you could come back to this site and write a quick tip/article about it... you could even include a little "this tip/article brought to you by..." blurb with a link to your company website...
Note: This is not meant to replace the standard User's Manual. We (Soholaunch) created it because we wanted a place to quickly post random/specialized information (i.e. installation troubleshooting, customization tricks, etc) without having to stop and think about private-branding issues or whether it might be so specialized (only relavant to a small minority) that it's existence might end up confusing more people than it helps.

Latest Updates

  • Working changelog started for upcoming v4.9 r21
  • New main page for wiki!
  • New troubleshooting tip on free trial period

Quick Links

Personal tools