current page test

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

current page test

Post 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
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: current page test

Post 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.
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: current page test

Post 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\" >";
}
brownrl
Forum Members
Forum Members
Posts: 74
Joined: Thu Sep 23, 2004 11:06 am

Re: current page test

Post 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
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: current page test

Post by Ted »

No problem.  I try to help where I can.

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

Return to “Developers Discussion”