Page 1 of 1

current page test

Posted: Wed Jul 13, 2005 3:12 pm
by brownrl
Hello,

I hope that this is not already answered I did a search and nothing came up.

I am writing a plugin,

I would like to know if there is some simple that will return to me the alias of the current page that the user is on?

I have a picture on the home page of a site and I only want to show that picture if the user is seeing the home page with out making one template for just the home page and the another template for the rest of the pages.

Yes I have to picture in the template... trust me on this.

So far I have this:

if( $_GET['page'] == "home" )

but that doesn't cover it. When the user first comes tot he site page is nt defined.
Any help would be super appreciated.

Rob

Re: current page test

Posted: Wed Jul 13, 2005 3:15 pm
by Ted
Try;

Code: Select all

global $gCms;
$thispage = $gCms->variables['page_name'];
That will give the alias or id depending on what was in the url.

Re: current page test

Posted: Wed Jul 13, 2005 3:24 pm
by brownrl
Almost worked...

tinkered and got it to work like this.

Code: Select all

global $gCms;
$thispage = $gCms->variables['page_name'];

if( $thispage == "home" || $thispage == "1")
{
     echo "<img src=\"uploads/images/intro.jpg\" border=\"0\" >";
}

Re: current page test

Posted: Wed Jul 13, 2005 3:36 pm
by brownrl
BTW

Wishy,

Thank you very much for being so proactive on this forum and helping us noobs out.

The project that I am working on now requires a webshop of sorts and I am going to write it module style. So hopefully in a few days here CMS MS gets an official shop module.

Thanks again.

Rob

Re: current page test

Posted: Wed Jul 13, 2005 3:42 pm
by Ted
No problem.  I try to help where I can.

That's great.  I'm very interested in seeing it.