php if statment help - page id?

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
itsc.net

php if statment help - page id?

Post by itsc.net »

Hi guys,

I'm trying to insert the following code into my template which will show a sidebar dependant on the page your looking at

Code: Select all

<div id="sidebar">
<?php 
	if ($body=='index') 
		{echo ' {global_content name='home-sidebar'} '} 
	elseif ($body=='about-us') 
		{echo ' {global_content name='about-sidebar'} '}  ...etc....etc ....etc
      ?>  
</div>

my problem is that i'm not sure how to get the body/ page id? I'm sure this must be set in the database to call the content etc dependant on the page.


can anyone tell me how to assign a body/page id or where to get this info?

many thanks in advance  :)
alby

Re: php if statment help - page id?

Post by alby »

itsc.net wrote: I'm trying to insert the following code into my template which will show a sidebar dependant on the page your looking at
.......
Use $page_alias variable:

{if $page_alias == 'home'} This is the Homepage
{else if $page_alias == 'about-us'} This About us
{else} Other page
{/if}

Alby
itsc.net

Re: php if statment help - page id?

Post by itsc.net »

thanks man :)
Locked

Return to “CMSMS Core”