Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

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

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
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 (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

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

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
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


Matt

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: 17,830
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/3 test site

Offline

#4 2020-06-10 18:52:39

Pixelmover
Member
From: Wiesbaden, Germany
Registered: 2017-02-14
Posts: 46
Website

Re: Updating phplugins

Daniel Leu wrote:

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

Is it possible that someone will rewrite the PHP script below from BL 1 to BL 3?
Unfortunately I have no experience to do this myself.

<?php
/*
 *	TTG Core Elements "PHPlugins" User Hooks v1.2 - initialization mainline
 *
 *	developed by john bishop images (http://johnbishopimages.com)
 *	for Matthew Campagna of The Turning Gate (http://theturninggate.net)
 *
 */

function ttg_user_load( $style, $path ) {
	$g_tsvrl = explode( ' ', $style );                          // Extract gallery type
	define ( 'G_STYLE', strtoupper($g_tsvrl[1]) );              // and set global for later
	$g_path = str_ireplace('\\','/',$path);                     // change \ to / 
	$chunks = explode('/',$g_path);                             // and put into array
	define ( 'G_PATH', strtoupper($chunks[count($chunks)-2]) ); // gallery folder name is second to last
	//define ( 'TTG_SITE', '');                                   // set new site root for navigation, resources, etc.
	}




// SET USER FUNCTIONS BELOW
// Some example functions are included below. Feel free to delete or modify unwanted functions.
// ****************************************************************************************************




// display Sitelock logo
function ttg_footer_bottom ( $style, $path ) {
echo <<<SITELOCK
<div id="sitelock">
<a href = "#" onclick = "window.open ('https://www.sitelock.com/verify.php?site=rainerhassmann.de','SiteLock','width=600,height= 600, left = 160, top = 170 '); "> <img title =" 1 & 1 SiteLock "src =" https://shield.sitelock.com/shield/rainerhassmann.de" alt =" Homepage Security "> </a>
</div>
SITELOCK;

} // END /**/




// ****************************************************************************************************
// END USER FUNCTIONS

?>

Pixelmover Rainer
Learn for a lifetime

Offline

#5 2020-06-10 21:55:04

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

Re: Updating phplugins

first thing to do is used the latest version of the phplugins file found in your Backlight 3 Installer download under backlight/custom/phplugins

I'm going to assume you're using Pangolin templates, so use the phplugins-pangolin-sample.php file

Then you can use the same function with just one difference: the first line

copy/paste your function into the User Functions area of the new file.

Change the first line from:

function ttg_footer_bottom ( $style, $path ) {

to

function footer_bottom() {

Be sure to use a plain text editor when doing this.

save the file, giving it a new name and upload it to your site at /backlight/custom/phplugins/

Select your new phplugins file in the page templates Advanced Setup area


that should be it.


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

Offline

#6 2020-06-11 06:09:23

Pixelmover
Member
From: Wiesbaden, Germany
Registered: 2017-02-14
Posts: 46
Website

Re: Updating phplugins

Hi Rod.
Thanks for your help.
It all worked out and I am very grateful for this great community.


Pixelmover Rainer
Learn for a lifetime

Offline

Board footer

Powered by FluxBB