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, 01:44 PM   #1
Chuck S
Photopost Developer
Verified Customer
Chuck S's Avatar
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 75,926
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.

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

$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'>
<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>
<div style='padding:2px'></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

$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.

$variable = "something here";

$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.

$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

$pphook['showproduct_below_image'] .= "<div style=\"padding:5px\"></div><ul><li>
Testing Plugin System below image
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.

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

[Valid] Markup Validation of - 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.

//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, 71 views)
File Type: jpg pphook-edit.jpg (80.1 KB, 56 views)
Attached Files
File Type: txt random_html_block.txt (538 Bytes, 19 views)
File Type: txt random_product.txt (3.7 KB, 20 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; September 8th, 2014 at 04:12 PM.
Chuck S is offline  
Old November 19th, 2014, 09:57 AM   #2
Chuck S
Photopost Developer
Verified Customer
Chuck S's Avatar
Join Date: Jun 2002
Location: Abingdon,MD
Posts: 75,926

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 09:27 AM
When will Photopost get a plugin system? Geiri General Discussion 1 December 20th, 2005 09:28 PM

All times are GMT -5. The time now is 11:12 AM.

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