Page 1 of 1

hi.. i need help with this code

Posted: Mon Mar 19, 2012 6:41 am
by guysoul
Hello,

I created a dynamic body ID. and this is my script

Code: Select all

if($page == "index.php")	{ 	echo '<body id="page1">'; }
	else if($page == "om.php") { echo '<body id="page2">'; }
For some reason its not working. When i go to index.php, the menu HOME is highlighted but when i go to om.php, the menu HOME is still highlighted.. It should highlight OM menu.

When i view the sourcecode on index.php, i saw two body tags:

<body id="page1">
<body id="page1">

When I view the sourcode on om.php. i saw this:
<body id="page2">
<body id="page1">

I dont understand why is this happening. it should only display one body tag. And each page, i declared the pages as:

For index.php , its $page = "index.php";
For om.php, its $page = "om.php";

Hope to hear from you soon.

Thanks and have a great day!

Regards,
Ed

Re: hi.. i need help with this code

Posted: Mon Mar 19, 2012 7:54 am
by guysoul
can anyone help me???

Re: hi.. i need help with this code

Posted: Mon Mar 19, 2012 8:19 am
by Celauran
guysoul wrote:can anyone help me???
Not with the information provided, no. Post more code so we can see what's causing the duplicated <body> tags.

Re: hi.. i need help with this code

Posted: Mon Mar 19, 2012 8:30 am
by guysoul
thanks for your response..

the code

Code: Select all

if($page == 'index.php')	
{ 	
	echo '<body id="page1">'; 
}
elseif($page == 'om.php')
{
	echo '<body id="page2">'; 
}
is written on the Template file.

On index.php and om.php, i declared a variable $page.

i hope this helps

Re: hi.. i need help with this code

Posted: Mon Mar 19, 2012 8:38 am
by Celauran
It doesn't help at all. That's what you posted in the first post. This explains the second body tag, but not the first.

Re: hi.. i need help with this code

Posted: Tue Mar 20, 2012 3:05 am
by guysoul
hi celauran,

I get it now. why it displayed two body tags.. :) my real concern is to create a PHP script that will automatically change the body id tag on each page since body tag is within the templates.

can u help me with my script above? i dont understand why it gives me an error.. thanks