Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2018-04-29 02:54:28

bdfisher
Member
Registered: 2012-09-25
Posts: 20

Target Specific Page with phplugin

I am trying to place HTML code at the bottom of the content in the Top-level Galleries page, but not in its sub-galleries (e.g. galleries/topic1, galleries/topic2, etc.) using phplugin.

I am less than a neophyte dealing with PHP, other than blindly using methods suggested in posts. I am already using the page copy area for another purpose and do not have any trays.

I have successfully used the method suggested in the post at http://community.theturninggate.net/vie … hp?id=8429 to place the HTML code at ttg_main_bottom of the Top-level Galleries page, but this also places the code in the sub-gallery pages, which i do not want.

A Google search turned up the function "is_page" that can be used to target a page based on its page ID or the page's slug. However that function seems to be specific to Wordpress, but not to PHP generally. 

I would appreciate any advice on how to handle this. Thanks in advance!

Barry

Offline

#2 2018-04-29 12:24:02

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

Re: Target Specific Page with phplugin

One way is to use php if statement and interrogate the page for the url of your top level gallery. If it is that url then the ttg_main_bottom function will run.

You'd have to look up how to do that or wait for someone who has more php knowledge.

Another option is to use use a separate page template that contains the phplugins function.
Clone your current page template.
Assign to it the phplugins file that contains the function to place the html
Create an album set specifically for the top-level gallery.
To this album set, assign the new page template.


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

Offline

#3 2018-04-29 12:52:39

bdfisher
Member
Registered: 2012-09-25
Posts: 20

Re: Target Specific Page with phplugin

Rod,

Thanks for the suggestions.

The method I adopted based on post 8429 (above) finds pages for which the URL contains "galleries", but it also finds the sub-galleries since their URL includes "galleries". I know virtually nothing about PHP, except what I learned searching Google. I tried to use PHP functions that look at the page content (e.g. - file_get_contents) to search for the slug of the galleries page (which is unique to that page), but do not know enough about PHP to work with the functions.

The second method that you have suggested is interesting. I will play with it and let you know the outcome.

Barry

Offline

#4 2018-04-29 13:35:58

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

Re: Target Specific Page with phplugin

you might try "galleries/index.php" instead of "galleries".

This may depend on your settings in Backlight that have to do with page urls.


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

Offline

#5 2018-04-30 12:40:23

bdfisher
Member
Registered: 2012-09-25
Posts: 20

Re: Target Specific Page with phplugin

Rod,

I had no success working with "galleries/index.php" approach. Although I could enter this address manually to access the galleries page, this also affected the home page (?). When I used this address in the code, it failed to access the page.

I was unable to find a setting in Backlight that permits changing the URL format to use …index.php. The Top Galleries page permits entering "galleries/index.php" for the directory but that seems to require other changes throughout the site and I did not pursue this.

The second method you proposed (unique page template and album set template for the galleries page) worked very well and that is what I am using. An excellent suggestion - a simple but very effective method.

I have been "inspired" by the method used by Monte Trumbull on his site (https://www.montetrumbull.com/) to easily display albums of personal favourites and recent additions. He builds these search terms into the URL's of thumbnails (…/backlight/search/?q=\'[term(s)]\').  The Backlight search function looks at text fields entered in Lightroom (caption, key words, etc.) and produces an album with the search results. I have placed this at the bottom of the galleries page using the phplugin, using the above method you suggested.  Several months ago I exchanged messages with Monte and he invited me to use his website as a guide. Thanks again Monte! I am now playing with the formatting of the search area - I clearly need to learn more CSS!

I am doing all of my work offline with MAMP and intend to upload the website soon (as soon as I stop "fiddling" with it).

Rod - thanks again for your help.

Barry

Offline

#6 2018-04-30 12:46:45

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

Re: Target Specific Page with phplugin

Monte has just about the best looking TTG based site I’ve seen. His sites have been great over a number of iterations of TTG products. Doesn’t hurt that his images are spectacular too!


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

Offline

#7 2018-05-06 02:36:41

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

Re: Target Specific Page with phplugin

bdfisher wrote:

I am trying to place HTML code at the bottom of the content in the Top-level Galleries page, but not in its sub-galleries (e.g. galleries/topic1, galleries/topic2, etc.) using phplugin.

I can't test it right now, but following might work for your case:

if (strcmp($_SERVER["REQUEST_URI"], "/galleries")) {
    echo "this is my html code";
}

Daniel Leu | Photography   
DanielLeu.com

Offline

#8 2018-05-15 08:54:24

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 170
Website

Re: Target Specific Page with phplugin

It had been a while since I checked the forum and ran across this. Thanks so much Barry and Rod. I appreciate the compliments!

Offline

Board footer

Powered by FluxBB