PhotoPost Photo Gallery Sales PhotoPost Sales Toll Free Phone Number
Mon-Fri 9am-4pm EST
  PhotoPost Photo Sharing Photo Gallery    Visualize community tm
| | | | | | | | |

Go Back   PhotoPost Community > General Forums > PhotoPost Product FAQs

PhotoPost Product FAQs Answers to your most frequently asked questions about all our products.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old August 17th, 2012, 12:44 PM   #1
Chuck S
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 75,136
New Plugin System FAQ!!!

The following is a tutorial on the new Plugin System we are including in our ReviewPost application. This will in time be ported to our Classifieds and PhotoPost Pro applications.

What the plugin system does is allow you to create plugins to define new html, banner ads or for the more technically minded individuals full php defined plugins to bring in new content into our applications without physically modifying our files thus making it easier for you in turn to upgrade. You can enable or disable the plugin system from the admin panel.

I have included with this first round release the following hook locations in the templates. There are 32 distinct locations. More will be added in time and customers are encouraged to make suggestions on locations.

Quote:
footer_top
footer_bottom
global
header_top
header_bottom
index_top
index_bottom
profile_side_top
profile_side_middle
profile_side_bottom
profile_main_top
profile_main_bottom
showcat_top
showcat_bottom
showmember_top
showmember_bottom
showproduct_details_top
showproduct_details_bottom
showproduct_top
showproduct_bottom
showproduct_above_image
showproduct_below_image
showproduct_above_thumbs
showproduct_below_thumbs
sidebar_left_top
sidebar_left_middle
sidebar_left_bottom
sidebar_right_top
sidebar_right_middle
sidebar_right_bottom
uploadproduct_top
uploadproduct_middle
uploadproduct_bottom
who_online_top
who_online_bottom
There are 4 attachments included in this tutorial first one shows the main plugin screen which is what you see when you hit the link Add/Edit Plugin and the next shows the edit screen of an individual plugin. The third is a random html box. The Fourth is a sample PHP random photo block. These should allow some insight in how to write plugins.

1. Things are pretty straight forward you enter a plugin title set the location you want to show the information and under the hookcode you enter whatever php code or html code you are trying to define and display.

2. The following is a sample of a simple block I defined to show on the sidebar_top location

Quote:
$pphook['sidebar_top'] .= "<div class='photoinfo' style='align:center; width:100%'>
<ul><li><div style='padding:2px'></div>
<table class='tableborders' border='0' cellpadding='6' cellspacing='1' width='100%' align='center'>
<tr>
<td width='100%' align='center'>
<div style='font-size:10pt; text-align:left;'>New Plugin</div>
<div class='catmenu'>
<div style='padding:5px'></div><ul><li>
<li>Testing Plugin System</li>
</li></ul></div>
</td>
</tr>
</table>
<div style='padding:2px'></div>
</li></ul>
</div>";
There is only one important thing to note here when defining the output of the plugins. Users of the vbulletin plugin system should already be aware of this. The outputted html that is rendered whether it is part of expensively defined while loops with php and mysql queries or a simple banner ad must be in this format

Quote:
$pphook['location'] .= " SOME HTML HERE ";
Lets pay attention to this line above for a second. Basically what your doing is creating an array of information. You can define multiple plugins on the same location and there is a way to set a specific order to the plugins that run on those locations. Therefore several important considerations here. The name of any printed output must be $pphook and the location name you picked as noted in my example. The names are the actual hook locations in the drop down so there is no confusion. Any content must be surrounded by double quotes and a trailing semi-colon that is a valid PHP line as noted in my example. Now you can define or use any php and queries to define variables to use in your html output. Variables you define in php are like the following examples.

Quote:
$variable = "something here";
or

Quote:
$variable['test'] = "something here";
Both are completely valid. Variables in your html output do not need to have brackets or quotes so the variable in your html to use would be $variable or $variable[test]

The important thing to note here is that double qoutes need to be used in the final hook html so that variable information will be rendered.

Quote:
$pphook['location'] .= " SOME HTML HERE ";
Now there are two schools of thought and both are valid. Any html you use between the hook define if you use double quotes in your html the qoutes need to be escaped like so

Quote:
$pphook['showproduct_below_image'] .= "<div style=\"padding:5px\"></div><ul><li>
Testing Plugin System below image
</li></ul></div>";
Now if you do not want to escape your double quotes in the html it is also valid to use single quotes in your html like so.

Quote:
$pphook['showproduct_below_image'] .= "<div style='padding:5px'></div><ul><li>
Testing Plugin System below image
</li></ul></div>";
Both will work and validate fine. I have used and tested both in my test site.

[Valid] Markup Validation of http://www.omegatron.net/reviews/index.php - W3C Markup Validator

I have tried to make things are straight forward and easy as possible. Doing a plugin should not crash your entire site so you should be able to go into admin and disable any plugin you are having an issue with. Now there is a global hook location which allows you to define some global variables etc and care should be taken when using that hook location. Now just incase you do crash your entire system with a global plugin we have included just like vbulletin a master define switch in the config-inc.php file you can remove the two forward slashes from and that should disable your plugin system so you can remove or fix the offending plugin.

Quote:
//define("ENABLE_HOOKS", 'off');
You can define hook location names yourself and add them to any template the same as vb following the tutorial.

Enjoy this new feature and feel free to post suggestions on future hook locations in any products respective suggestions forum. As noted there are 32 hook locations which is a good beginning and should allow a good start for the new system covering most locations people want to include content.
Attached Images
File Type: jpg pphook-main.jpg (91.4 KB, 68 views)
File Type: jpg pphook-edit.jpg (80.1 KB, 54 views)
Attached Files
File Type: txt random_html_block.txt (538 Bytes, 18 views)
File Type: txt random_product.txt (3.7 KB, 19 views)
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.

Last edited by Chuck S; February 12th, 2013 at 01:10 PM.
Chuck S is offline  
Old June 7th, 2014, 11:05 AM   #2
Chuck S
Photopost Developer
Verified Customer
 
Chuck S's Avatar
 
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 75,136
http://www.photopost.com/forum/forumdisplay.php?f=207

I am looking for new plugin ideas. You can see what plugins exist and let me know your thoughts. Remember good plugins might be good enough into time to become supported features so all ideas welcome.
__________________
Photopost Developer and Support Engineer

Please do not PM me for support or sales questions. Thank you for your understanding.
Chuck S is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New plugin system !!! Chuck S General Discussion 12 October 2nd, 2012 08:27 AM
When will Photopost get a plugin system? Geiri General Discussion 1 December 20th, 2005 08:28 PM
Will you use theVB 3.5 hooks and plugin system ? Sharg Before You Buy 11 October 10th, 2005 07:14 PM


All times are GMT -5. The time now is 03:08 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.