Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2018-09-13 02:35:31

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,425
Website

Updating phplugins

This is just a short summary on how to update phplugins from Backlight 1 to Backlight 2.

It's a good idea to look at the new sample file (backlight/custom/phplugins/phplugins-pangolin-sample.php) to see all the available functions and how the file structure is.

1) Phplugins are now class based. So all functions need to be defined within a class context. This is well seen in the example file.

class PHPlugins extends APHPlugins {
  // put your functions here 
}

2) Function names changed and lost their arguments. You only need to remove the ttg_ prefix and whatever is between parentheses.
Before:

function ttg_pallet_top_title( $style, $path ) { 
	echo '
		// ......
	';
	return false;
} // END /**/

After:

// Basic structure for a PHPlugins function
function pallet_top_title() { 
	echo '
		// ......
	';
	return false;
} // END /**/

3) If you call another function within the PHPlugins class, you need to use

$this->my_function()

instead of just

my_function()

4) Backlight 1 $style and $path arguments are accessible as

$this->style

and

$this->path

Tip:

Please first make a copy of either /backlight/custom/phplugins/phplugins-pangolin-sample.php or /backlight/custom/phplugins/phplugins-okapi-sample.php and give it a good name: let's call it /backlight/custom/phplugins/site-phplugins.php. Then select this file in your template editor as your site's phplugins file. Add your custom functions from your Backlight 1 phplugins file and adjust them accordingly.

Last edited by Daniel Leu (2018-12-19 07:46:19)


Daniel Leu | Photography   
DanielLeu.com
My digital playground: lab.DanielLeu.com

Offline

#2 2018-09-13 02:56:31

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,613
Website

Re: Updating phplugins

Thanks, Daniel! This was on my To-do list, but you've just saved me having to find that time. big_smile


Campagna Pictures, http://campagnapictures.com
The Turning Gate, http://theturninggate.net

Offline

#3 2018-12-13 01:56:17

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 16,806
Website

Re: Updating phplugins

And make sure to start with the file named phplugins-pangolin-sample.php or phplugins-okapi-sample.php (if you're still using Okapi page templates). They are the ones that are set up for Backlight 2.

Last edited by rod barbee (2019-09-13 01:28:52)


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2 test site, Pangolin test site

Offline

Board footer

Powered by FluxBB