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 2017-07-06 23:35:44

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 359
Website

get page URL?

I'm trying to get the URL of various pages on my site in phpPlugins so I can add something only on the home with ttg_main_bottom.

The code i'm using is: $actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

except it always returns the home page URL on each page except for the galleries

eg: I always see https://stalkinglight.com even when the page URL is https://stalkinglight.com/about/.

Offline

#2 2017-07-07 02:25:42

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

Re: get page URL?

Hi Charlie,

I use following function to determine if I am on the home page:

function is_home_page() {
   if ( $_SERVER["REQUEST_URI"] == '/' ) {
      return 1;
   }  else {
      return 0;
   }
}

Based on what you wrote, this doesn't seem to work for your host sad


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#3 2017-07-07 02:40:05

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 359
Website

Re: get page URL?

Thanks Daniel,

I'm doing something wrong since I have the exact same code in both ttg_main_bottom and ttg_single_bottom and the results are different - works fine in ttg_single_bottom but only returns the home page URL in ttg_main_bottom.

I'm using a LAMP server on my own computer.

Offline

#4 2017-07-07 02:49:26

charlie.choc
Member
From: Marietta, GA
Registered: 2014-01-09
Posts: 359
Website

Re: get page URL?

OK, I figured it out. I was using "=" instead of "==" in my comparison so I was actually assigning the variable instead of comparing them. Obviously I've forgotten my C/C++ days. sad

Offline

#5 2017-07-07 02:56:17

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

Re: get page URL?

charlie.choc wrote:

OK, I figured it out. I was using "=" instead of "==" in my comparison so I was actually assigning the variable instead of comparing them. Obviously I've forgotten my C/C++ days. sad

Great! Don't know how many hours total I lost overlooking this type of typo.... wink


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

Board footer

Powered by FluxBB