Creating a basic plugin

From Sohowiki
(Difference between revisions)
Jump to: navigation, search
m
(Create an install_manifest.php for your plugin)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=218 qwest ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=349 cheap vicodin] [http://wc1.worldcrossing.com/WebX/.1de609fe free qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=225 kyocera ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=174 order cyclobenzaprine] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=186 jazz ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=171 cheap clomid] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=144 cheap xanax] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=236 tracfone ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=180 flexeril] [http://wc1.worldcrossing.com/WebX/.1de609f3 free midi ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a2c ultram] [http://wc1.worldcrossing.com/WebX/.1de60a34 free sony ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0d wwe ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=207 real ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=110 free nokia ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=220 punk ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=203 funny ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=173 free cool ringtones] [http://wc1.worldcrossing.com/WebX/.1de609eb free funny ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=83 didrex online] [http://wc1.worldcrossing.com/WebX/.1de60a21 paxil online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=172 lorazepam] [http://wc1.worldcrossing.com/WebX/.1de60a1a mtv ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=71 buy alprazolam] [http://news.engin.brown.edu/forums/thread-view.asp?tid=190 pharmacy online online] [http://wc1.worldcrossing.com/WebX/.1de60a03 free sony ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=201 free free ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0b cheap vigrx] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=211 polyphonic ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=358 mp3 ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a23 free polyphonic ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=213 free polyphonic ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=150 tramadol online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=163 cheap adipex] [http://wc1.worldcrossing.com/WebX/.1de60a2b but ultracet] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=219 viagra online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=82 buy diazepam] [http://news.engin.brown.edu/forums/thread-view.asp?tid=185 zoloft online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=192 cheap vigrx] [http://wc1.worldcrossing.com/WebX/.1de60a1f lisinopril online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=114 pharmacy online online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=75 celexa online] [http://wc1.worldcrossing.com/WebX/.1de60a05 sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e4 clonazepam online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=353 levitra online] [http://wc1.worldcrossing.com/WebX/.1de60a27 but sildenafil] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=140 vicodin online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=337 xanax] [http://wc1.worldcrossing.com/WebX/.1de60a2d cheap valium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=206 cheap pharmacy online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=126 cheap sildenafil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=174 cheap wellbutrin] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=160 cheap adipex] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=221 vicodin online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=143 wwe ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=70 free alltel ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=230 verizon ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=102 free midi ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=118 prozac online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=189 but lipitor] [http://news.engin.brown.edu/forums/thread-view.asp?tid=218 sony ericsson ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=232 free sony ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=161 albuterol online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=161 viagra online] [http://wc1.worldcrossing.com/WebX/.1de609e1 cheap carisoprodol] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=128 sony ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a24 propecia online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=200 nexium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=191 lorazepam online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=197 flexeril online] [http://wc1.worldcrossing.com/WebX/.1de60a07 tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=182 clomid online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=205 cheap paxil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=208 free motorola ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=216 order zyban] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=120 qwest ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=109 nextel ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=79 clonazepam online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=211 music ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=226 cheap tramadol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=333 soma online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=81 cyclobenzaprine online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=332 order tramadol] [http://news.engin.brown.edu/forums/thread-view.asp?tid=160 buy ativan] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=68 buy adipex] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=108 nexium online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=167 cheap clonazepam] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=90 cheap hgh] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=132 cheap tenuate] [http://wc1.worldcrossing.com/WebX/.1de60a32 online zoloft] [http://news.engin.brown.edu/forums/thread-view.asp?tid=223 free midi ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=166 alprazolam online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=72 cheap ambien] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=241 free sony ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=184 lisinopril online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=194 midi ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=74 carisoprodol online] [http://wc1.worldcrossing.com/WebX/.1de609f8 free nokia ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=182 funny ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=176 cheap didrex] [http://news.engin.brown.edu/forums/thread-view.asp?tid=196 hgh online] [http://wc1.worldcrossing.com/WebX/.1de60a10 didrex online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=129 sony ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=339 cheap ultram] [http://wc1.worldcrossing.com/WebX/.1de609ec buy hgh] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=85 ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=156 fioricet] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=76 cialis] [http://wc1.worldcrossing.com/WebX/.1de60a1e flexeril online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=336 cheap carisoprodol] [http://wc1.worldcrossing.com/WebX/.1de609ff real ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=198 cheap hoodia] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=165 ambien] [http://news.engin.brown.edu/forums/thread-view.asp?tid=186 cheap lipitor] [http://wc1.worldcrossing.com/WebX/.1de609fa free online pharmacy] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=88 free ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=146 zanaflex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=153 cheap phentermine] [http://wc1.worldcrossing.com/WebX/.1de60a11 buy diethylpropion] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=240 buy soma] [http://news.engin.brown.edu/forums/thread-view.asp?tid=210 sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e7 diazepam online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=125 free sharp ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=170 hydrocodone online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=347 adipex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=155 buy xanax] [http://wc1.worldcrossing.com/WebX/.1de609e3 cheap clomid] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=356 tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=222 free sharp ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=98 online lisinopril] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=223 wellbutrin online] [http://wc1.worldcrossing.com/WebX/.1de60a15 kyocera ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=362 motorola ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=115 phentermine online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=215 buy zoloft] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=167 cheap carisoprodol] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=164 alprazolam online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=177 diethylpropion online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=200 free nokia ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=69 cheap albuterol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=357 funny ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=334 cheap valium] [http://wc1.worldcrossing.com/WebX/.1de60a29 buy tramadol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=338 fioricet] [http://wc1.worldcrossing.com/WebX/.1de60a09 cheap viagra] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=124 samsung ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=198 mtv ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=164 norco online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=199 free music ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=166 ativan online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=188 cheap tenuate] [http://wc1.worldcrossing.com/WebX/.1de60a17 lipitor online] [http://wc1.worldcrossing.com/WebX/.1de60a12 ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=151 soma online] [http://wc1.worldcrossing.com/WebX/.1de609df ambien online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=231 order rivotril] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=343 online cialis] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=134 buy tramadol] [http://news.engin.brown.edu/forums/thread-view.asp?tid=227 free ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=228 free mtv ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=177 cheap propecia] [http://wc1.worldcrossing.com/WebX/.1de60a14 free jazz ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=187 free kyocera ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=345 viagra online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=348 but norco] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=162 free alltel ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=193 zanaflex online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=196 motorola ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=139 cheap viagra] [http://news.engin.brown.edu/forums/thread-view.asp?tid=191 lortab online] [http://wc1.worldcrossing.com/WebX/.1de60a1b music ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a19 mp3 ringtones] [http://wc1.worldcrossing.com/WebX/.1de609dc albuterol online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=351 buy clonazepam] [http://news.engin.brown.edu/forums/thread-view.asp?tid=171 ambien online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=173 xenical online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=121 real ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a20 cheap nexium] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=142 wellbutrin] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=130 sonyericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0e cheap celexa] [http://news.engin.brown.edu/forums/thread-view.asp?tid=158 cheap diazepam] [http://wc1.worldcrossing.com/WebX/.1de609f7 nextel ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a28 soma online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=197 mp3 ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=184 hoodia online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=359 free nextel ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=165 vicodin online] [http://wc1.worldcrossing.com/WebX/.1de60a01 free sagem ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=217 punk ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=117 order propecia] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=195 mono ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=116 polyphonic ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=96 levitra online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=224 free wwe ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f0 lorazepam online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=209 free samsung ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a31 zanaflex online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=203 norco] [http://people.msoe.edu/~millerni/forums.php?show=topic
+
==Introduction==
 +
This tutorial will walk you through the creation of a basic plugin that opens a javascript alert box with the text "Hello World" in it on every page of your website (annoying, I know, but at least you'll know it's working).
 +
 
 +
'''[http://soholaunch.com/media/hello-world.zip Download the example plugin]'''
 +
 
 +
'''You'll need...'''
 +
#A website with Soholaunch (Pro or Ultra) installed on it.
 +
#Your favorite code editor (for php)
 +
#Comfort editing basic php code
 +
#Some comfort with Soholaunch's file structure will help, but is not essential.
 +
#FTP access to your website
 +
 
 +
==Create a folder for your plugin==
 +
Create a folder on your computer called ''hello-world''. All of your plugin's files will go in this folder.
 +
 
 +
==Find the hook you want to attach your custom file to==
 +
Open Your FTP client and log-in to your test site. For this example, we're going to add code to your soho-created website's html. The file below builds the website's html...
 +
<pre>public_html/sohoadmin/client_files/pgm-realtime_builder.php</pre>
 +
 
 +
Open that file, and scroll all the way to the bottom. You'll see this line...
 +
<pre># Add stuff to final html
 +
eval(hook("pgm-realtime_builder.php:add-to-final-html"));</pre>
 +
 
 +
That's what a hook looks like in the Soholaunch source code. This is where your file will be included. The text inside the hook() function call (pgm-realtime_builder.php:add-to-final-html) is the hook id that you need for your plugin's install_manifest.php file.
 +
 
 +
==Create your include file==
 +
In your ''hello-world'' folder, create a file called ''hello-world.php'' (note: actual filename doesn't matter). This file will contain add a javascript alert to the ''$template_footer'' variable's contents. The ''$template_footer'' variable contains all of the website html from the page content downward (so all content that gets swapped-in for #content#, as well as the template html that follows #content# in the template file).
 +
 
 +
Contents of hello-world.php...
 +
<pre><?php
 +
$template_footer .= '<script>alert("Hello, World.");</script>';
 +
?></pre>
 +
 
 +
==Create an install_manifest.php for your plugin==
 +
The ''install_manifest.php'' is the configuration file for your plugin. Every Soholaunch plugin has an ''install_manifest.php''. This file is read by Soholaunch when the user installs the plugin. It tells Soholaunch how to display your plugin (title, author, etc), and where to hook its files into.
 +
 
 +
There are two types of content in any given ''install_manifest.php'':
 +
#'''Information''' - plugin title, author, etc
 +
#'''Instructions''' - "hook me in here, here, and here"
 +
 
 +
Here's what our install_manifest.php is going to look like...
 +
<pre><?php
 +
# This should match your plugin's folder name
 +
$plugin_folder = "hello-world";
 +
 
 +
# These are just for display to the user, you can define them however you see fit (html allowed)
 +
$plugin_title = "Hello World";
 +
$plugin_version = "2.0";
 +
$plugin_author = "Soholaunch.com, Inc.";
 +
$plugin_homepage = "http://example.com";
 +
$plugin_description = "Adds drag and drop 'Hello World' item to the Page Editor";
 +
 
 +
# This creates a link on the admin panel to the script specified (helloworld_settings.php)
 +
$plugin_options_link = "helloworld_settings.php";
 +
 
 +
# This creates a button & description on the admin panel to the script specified (helloworld_settings.php)
 +
$data['enabled_button_link'] = "helloworld_settings.php";
 +
$data['button_caption_text'] = "Hello World Settings";
 +
hook_special("main_menu_button", $data);
 +
 
 +
/* Include my hello-world.php file at *this* location (specified by hook id found in the Soholaunch source code) */
 +
hook_attach("hello-world.php", "pgm-realtime_builder.php:add-to-final-html");
 +
?></pre>
 +
 
 +
====Optional: Plugin icon====
 +
If you'd like your plugin to have it's own icon displayed next to it's name in the Plugin Manager (instead of the default puzzle piece graphic), include the image file in your plugin folder, and add a line like this to your install_manifest.php...
 +
$plugin_icon = "my_plugin_icon.gif"
 +
 
 +
 
 +
====Optional: Plugin Options Link====
 +
This adds a link to your plugin's settings page. The .php file should be inside your plugin directory.
 +
$plugin_options_link="my_plugins_settings.php";
 +
 
 +
==Recap: This is what your plugin folder should look like==
 +
At this point your plugin is essentially done.
 +
 
 +
Your plugin folder should look like this now...
 +
 
 +
<pre>hello-world/
 +
install_manifest.php
 +
main_menu-helloworld.php</pre>
 +
 
 +
Using winzip, winrar, or other similar archive app, zip-up your ''hello-world'' folder (the folder itself, not just the contents). In Windows, you'd right-click on the ''hello-world'' folder and click "Add to archive..."
 +
 
 +
For purposes of example, name your .zip file *hello-world.zip*
 +
 
 +
==You're ready==
 +
Your plugin is finished and ready to rock. Log-in to ''/sohoadmin'' and upload/install your hello-world.zip via the Plugin Manager.
 +
 
 +
Then view your website, and you should see the "Hello, World" javascript alert.
 +
 
 +
[[Category:Plugins]]

Latest revision as of 12:39, 4 December 2013

Contents

Introduction

This tutorial will walk you through the creation of a basic plugin that opens a javascript alert box with the text "Hello World" in it on every page of your website (annoying, I know, but at least you'll know it's working).

Download the example plugin

You'll need...

  1. A website with Soholaunch (Pro or Ultra) installed on it.
  2. Your favorite code editor (for php)
  3. Comfort editing basic php code
  4. Some comfort with Soholaunch's file structure will help, but is not essential.
  5. FTP access to your website

Create a folder for your plugin

Create a folder on your computer called hello-world. All of your plugin's files will go in this folder.

Find the hook you want to attach your custom file to

Open Your FTP client and log-in to your test site. For this example, we're going to add code to your soho-created website's html. The file below builds the website's html...

public_html/sohoadmin/client_files/pgm-realtime_builder.php

Open that file, and scroll all the way to the bottom. You'll see this line...

# Add stuff to final html
eval(hook("pgm-realtime_builder.php:add-to-final-html"));

That's what a hook looks like in the Soholaunch source code. This is where your file will be included. The text inside the hook() function call (pgm-realtime_builder.php:add-to-final-html) is the hook id that you need for your plugin's install_manifest.php file.

Create your include file

In your hello-world folder, create a file called hello-world.php (note: actual filename doesn't matter). This file will contain add a javascript alert to the $template_footer variable's contents. The $template_footer variable contains all of the website html from the page content downward (so all content that gets swapped-in for #content#, as well as the template html that follows #content# in the template file).

Contents of hello-world.php...

<?php
$template_footer .= '<script>alert("Hello, World.");</script>';
?>

Create an install_manifest.php for your plugin

The install_manifest.php is the configuration file for your plugin. Every Soholaunch plugin has an install_manifest.php. This file is read by Soholaunch when the user installs the plugin. It tells Soholaunch how to display your plugin (title, author, etc), and where to hook its files into.

There are two types of content in any given install_manifest.php:

  1. Information - plugin title, author, etc
  2. Instructions - "hook me in here, here, and here"

Here's what our install_manifest.php is going to look like...

<?php
# This should match your plugin's folder name
$plugin_folder 		= "hello-world";

# These are just for display to the user, you can define them however you see fit (html allowed)
$plugin_title 		= "Hello World";
$plugin_version 	= "2.0";
$plugin_author 		= "Soholaunch.com, Inc.";
$plugin_homepage 	= "http://example.com";
$plugin_description 	= "Adds drag and drop 'Hello World' item to the Page Editor";

# This creates a link on the admin panel to the script specified (helloworld_settings.php)
$plugin_options_link = "helloworld_settings.php";

# This creates a button & description on the admin panel to the script specified (helloworld_settings.php)
$data['enabled_button_link'] = "helloworld_settings.php";
$data['button_caption_text'] = "Hello World Settings";
hook_special("main_menu_button", $data);

/* Include my hello-world.php file at *this* location (specified by hook id found in the Soholaunch source code) */
hook_attach("hello-world.php", "pgm-realtime_builder.php:add-to-final-html");
?>

Optional: Plugin icon

If you'd like your plugin to have it's own icon displayed next to it's name in the Plugin Manager (instead of the default puzzle piece graphic), include the image file in your plugin folder, and add a line like this to your install_manifest.php...

$plugin_icon = "my_plugin_icon.gif"


Optional: Plugin Options Link

This adds a link to your plugin's settings page. The .php file should be inside your plugin directory. $plugin_options_link="my_plugins_settings.php";

Recap: This is what your plugin folder should look like

At this point your plugin is essentially done.

Your plugin folder should look like this now...

hello-world/
 install_manifest.php
 main_menu-helloworld.php

Using winzip, winrar, or other similar archive app, zip-up your hello-world folder (the folder itself, not just the contents). In Windows, you'd right-click on the hello-world folder and click "Add to archive..."

For purposes of example, name your .zip file *hello-world.zip*

You're ready

Your plugin is finished and ready to rock. Log-in to /sohoadmin and upload/install your hello-world.zip via the Plugin Manager.

Then view your website, and you should see the "Hello, World" javascript alert.

Personal tools