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 2020-06-11 01:10:54

bobby
Member
Registered: 2020-06-03
Posts: 6

PHPlugin BL1 needs update to BL 3

Years ago I luckily recieved this Plugin - unfortunatly I don`t know PHP

This phplugin works with BL1 but not BL3
It enables the selected menu-item to hold its color as long pages in that menu are selected.

On BL1 this PHPlugin works perfectly as can be seen here:
http://www.beautybobby.de/nature/

On BL3 the same PHPlugin does not work as can be seen here:
http://www.bobbyboe.com/nature/

Can anybody help me? What needs to be changed in the code?

<?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.
    }

/*
*   
*    *************************************************************************************
*    *                                                                                   *
*    * Warning! When using echo or print special care must be qiven to using quotes.     *
*    *                                                                                   *
*    * Strings inside single quotes must contain only double quotes                      *
*    * or all single quotes must be escaped (ie \') or vice-versa                        *
*    *                                                                                   *
*    *************************************************************************************
*   
*    Fourteen user exits are defined in all web engines - all are optional
*        (i.e. ttg_user_load.php may be the only processing)
*       
*    Some web engines will have additional exits defined, specific to that gallery type
*       
*    Each is called with the same parameters:
*        %1    -    TTG gallery-style gallery-release
*                3 blank delimited values
*                - %1.1    -    'TTG'
*                - %1.2    -    string describing gallery type; no embedded blanks
*                - %1.3    -    a series of two to three period delimited integers
*                            describing gallery release level; x.y or x.y.z
*        %2    -    server filesystem file name and path of calling file
*       
*
*    Defined exits:
*
*        ttg_user_load           
*      - return value ignored
*      - called immediately after this file returns
*      - called before any output is produced
*      - all header and response variables are accessible
*      - cookie and session processing can be initialized
*      - globals to be used by later hook calls can be defined
*
*    ttg_head
*      - return value ignored
*      - called immediately before </head>
*      - encompasses nothing; use to insert content into the <head>
*
*    ttg_header_top
*      - if return=false, the contents of the normal Backlight header are skipped
*      - called immediately within the header section
*      - encompasses the full contents of the header section; can be used to replace those contents
*
*    ttg_header_bottom
*      - return value ignored
*      - called last in the header section
*      - encompasses nothing; use to insert content at the end of the header section
*
*    ttg_masthead_top
*      - if return=false, normal Backlight masthead is skipped
*      - called immediately before the masthead element
*      - fully encompasses the masthead; can be used to replace it
*
*    ttg_masthead_bottom
*      - return value ignored
*      - called immediately after the masthead
*      - encompasses nothing; use to insert content after the masthead
*
*    ttg_navigation
*      - if return=false, normal Backlight navigation is skipped
*      - navigation is separate from the header section, so not affected by the above ttg_header... hooks.
*      - encompasses the navigation <ul> element; can be used to replace it
*
*    ttg_footer_top
*      - if return=false, the contents of the normal Backlight footer are skipped
*      - called immediately within the footer section
*      - encompasses the full contents of the footer section; can be used to replace those contents
*
*    ttg_footer_bottom
*      - return value ignored
*      - called last in the footer section
*      - encompasses nothing; use to insert content at the end of the footer section
*
*    ttg_scripts
*      - return value ignored
*      - called immediately before </body>
*      - encompasses nothing; use to insert content at the very bottom of the page
*
*    ttg_main_top
*      - return value ignored
*      - called immediately within the main content column
*      - encompasses nothing; use to insert content at the very top of the main content column
*      - located outside the password protected area
*
*    ttg_main_bottom
*      - return value ignored
*      - called immediately before closing the main content column
*      - encompasses nothing; use to insert content at the very bottom of the main content column
*      - located outside the password protected area
*
*    ttg_copy_top
*      - if return=false, normal copy is skipped
*      - called immediately within the page copy area
*      - encompasses the page copy; can be used to replace it
*
*    ttg_copy_bottom
*      - return value ignored
*      - called immediately before closing the page copy area
*      - encompasses nothing; use to insert content following the page copy
*
*    ttg_single_top
*      - if return=false, single image and content are skipped
*      - called immediately above the single image display
*      - encompasses the single image and related metadata; can be used to replace it
*      - available only on single-image HTML pages for applicable album templates
*
*    ttg_single_bottom
*      - return value ignored
*      - called after the single image display
*      - encompasses nothing; use to insert content following the single image display
*      - available only on single-image HTML pages for applicable album templates
*
*    ttg_tray01_top
*      - if return=false, tray content is skipped
*      - called within tray01, after masthead and navigation
*      - encompasses the tray01 content area
*
*    ttg_tray01_bottom
*      - return value ignored
*      - called after the tray01 content
*      - encompasses nothing; use to insert content at the end of tray01
*
*    ttg_tray02_top
*      - if return=false, tray content is skipped
*      - called within tray02, after masthead and navigation
*      - encompasses the tray02 content area
*
*    ttg_tray02_bottom
*      - return value ignored
*      - called after the tray02 content
*      - encompasses nothing; use to insert content at the end of tray02
*
*    ttg_gallery_top
*      - if return=false, normal copy is skipped
*      - called immediately within the media area
*      - encompasses the gallery grid / slideshow; can be used to replace it
*
*    ttg_gallery_bottom
*      - return value ignored
*      - called immediately before closing the media area
*      - encompasses nothing; use to insert content following the gallery grid / slideshow
*
*/


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




/* DELETE THIS LINE
function _HOOK_( $style, $path ) {
    echo '

    ';
    return false;
} // END
DELETE THIS LINE */




/* DELETE THIS LINE
function ttg_main_top( $style, $path ) {
    echo '<ul style="background-color:#FFF9C4;color:#000;margin:1.5rem 0;padding:24px 36px;">';
        if (PASSWORD_ENABLED) {
            echo '<li><strong>This gallery is private</strong>.</li>';
            if (LOGGED_IN) {
                echo '<li><small>The user is logged in</small>.</li>';
            } else {
                echo '<li><small>The user is logged out</small>.</li>';
            }
        } else {
            echo '<li><strong>This gallery is public</strong>.</li>';
        }
    echo '</ul>';
    return false;
} // END
DELETE THIS LINE */




/* DELETE THIS LINE
function ttg_navigation( $style, $path ) {
    echo '
    <ul class="primary-menu menu">
        <li class="menu-item"><a href="/">Home</a></li>
        <li class="menu-item menu-item-has-children"><a href="/galleries">Galleries</a>
            <ul class="sub-menu">
                <li class="menu-item"><a href="">Sub-item 1</a></li>
                <li class="menu-item"><a href="">Sub-item 2</a></li>
            </ul>
        </li>
        <li class="menu-item"><a href="/about">About</a></li>
        <li class="menu-item"><a href="/contact">Contact</a></li>
    </ul>
    ';
    return false;
} // END
DELETE THIS LINE */

function ttg_scripts( $style, $path ) {
   
echo <<<SCRIPT
<script>
    $(function() {
        $("ul.menu a[href='" + window.location.pathname + "']").addClass("selected");
    });
    $("ul.menu a[href='" + window.location.pathname + "']").addClass("selected").parents('li').children().addClass('selected');
</script>
SCRIPT;

} // END


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

?>

Offline

#2 2020-06-11 01:24:25

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

Re: PHPlugin BL1 needs update to BL 3


Matt

The Turning Gate, http://theturninggate.net

Offline

#3 2020-06-11 01:25:23

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

Re: PHPlugin BL1 needs update to BL 3

you need to update to the latest phplugins file found in your Backlight 3 Installer download. use the phplugins-pangolin-sample.php file. You'll find it in the backlight/custom/phplugins folder.

paste your functions into the new file.

Then you'll need to modify the functions
for example, this:

function ttg_navigation( $style, $path ) {

becomes this:

function navigation() {

You also may need to change the html in your code as some html structure has changed between BL1 and Bl2/3

see this: http://community.theturninggate.net/vie … hp?id=8966
and the phplugins documentation: https://backlight.me/docs/using-phplugins


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-12 00:37:47

bobby
Member
Registered: 2020-06-03
Posts: 6

Re: PHPlugin BL1 needs update to BL 3

OK... what I have done wasn't based on deep knowledge... but it works, thank you @Matt and @Rod.

My initial mistake was not to realize, that I had overpasted the new phplugins-pangolin-sample.php,
because I had copied and pasted the folders "custom" and "data" completely from the BL1 site.

Is there anything else in these 2 folders, that should be used from Backlight3 ?
(excluding my design from BL 1... that I have happily transferred)

So far I am happy that I managed to jump from BL1 to BL3

Offline

#5 2020-06-12 00:45:35

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

Re: PHPlugin BL1 needs update to BL 3

Is there anything else in these 2 folders, that should be used from Backlight3 ?

I don't think so.


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

Offline

Board footer

Powered by FluxBB