Check if default page?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
hansom

Check if default page?

Post by hansom »

Is there any way that I can check if the currently rendered page is the Default page. For example inside a template something like {if default_page}. If not, how can I accomplish this, with a tag/plugin? I'm running 0.13-beta1.
TIA
Raven

Re: Check if default page?

Post by Raven »

It would be a bit easier if you shared with us why you want this?

If you need this to display some extra functions etc. Please note that you can have your own seperate style/layout for your default page.
Last edited by Raven on Sat May 06, 2006 7:43 pm, edited 1 time in total.
hansom

Re: Check if default page?

Post by hansom »

Sorry for the lack of info, I had a Menu Manager template that I wanted to render slightly different on the default page. And I didn't want to have two separate templates. Here's what I did:

Code: Select all

{php}
global $gCms;
$this->assign('default_content_page', ($gCms->variables['content_id'] == ContentManager::GetDefaultPageID()));
{/php}
I eventually scrapped the idea and chose a different layout. But anyway, is there a better way to do this, if the need comes up again?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Check if default page?

Post by Ted »

Does you default page id change often?  If not, then you can just do something like (assuming the default page is id 1):

Code: Select all

{if $node->id == 1}
  //Do Stuff
{/if}
in your menu manager template.
hansom

Re: Check if default page?

Post by hansom »

Yeah I know. But since the default page probably will be changed someday I wanted a solution that just works without having to update the template. It's just the way I like things to work... :)
Locked

Return to “CMSMS Core”