Community @ The Turning Gate

Support community for TTG plugins and products.


The Turning Gate's Community has moved to a new home, at

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-02-03 13:01:09

From: Peoria (Phoenix) AZ
Registered: 2012-10-01
Posts: 180

Adding a counter to Backlight pages

In CE4, I used some php code to add a 'Statcounter' icon to several pages on my site.  The php code may be seen at this link … sp=sharing

To locate the correct pages, it uses

function ttg_footer_bottom ( $style, $path ) {
    if (G_STYLE == 'CE4-PAGES-HOME') {
        echo '

elseif (G_PATH == 'CLUBS') {
        echo '

        echo '

Will this work in Backlight?  Are these still appropriate variables to use in Backlight?

Here is a snipit of the php script

// Add statcounter HOME
function ttg_footer_bottom ( $style, $path ) {
    if (G_STYLE == 'CE4-PAGES-HOME') {
        echo '

<!-- Start of StatCounter Code for Default Guide -->
    <script type="text/javascript">
    var sc_project=10262831;
    var sc_invisible=0;
    var sc_security="13728379";
    var scJsHost = (("https:" ==             document.location.protocol) ?
    "https://secure." : "http://www.");
    document.write("<sc"+"ript type=\'text/javascript\' src=\'" +
    <noscript><div class="statcounter"><a title="shopify site
    analytics" href=""
    target="_blank"><img class="statcounter"
    alt="shopify site analytics"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->

    return false;


    elseif (G_PATH == 'CLUBS') {
        echo '

<!-- Start of StatCounter Code for Default Guide -->



#2 2018-02-03 15:08:07

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

Re: Adding a counter to Backlight pages

That won’t work. See the phplugins sample files for the Backlight hooks. Scripts should go in the ttg_scripts hook.

G_PATH and G_STYLE are no longer part of phplugins.

one option is separate page templates using separate phplugins files for each page.

Another is using php to check for a page and insert your script conditionally.

Daniel recently posted some code he uses for conditionally inserting code into specific pages … 056#p51056

Just a user with way too much time on his hands., Backlight 2/3 test site


Board footer

Powered by FluxBB