Page 1 of 1
Check if default page?
Posted: Mon May 01, 2006 4:25 pm
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
Re: Check if default page?
Posted: Sat May 06, 2006 10:53 am
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.
Re: Check if default page?
Posted: Mon May 08, 2006 11:53 am
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?
Re: Check if default page?
Posted: Mon May 08, 2006 5:30 pm
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.
Re: Check if default page?
Posted: Tue May 09, 2006 9:28 pm
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...
