CodeIgniter Forums
body class on one page only - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: body class on one page only (/showthread.php?tid=59113)



body class on one page only - El Forum - 08-26-2013

[eluser]Unknown[/eluser]
Hello,

I have a design I'm currently trying to implement into CodeIgniter that has a body class on the home page only.

I've spent the entire day trying to solve the issue, searching etc and have come up empty handed.

If the page = http://www.mysite.tld/ or http://www.mysite.tld/index I need to to have the following body tag;

Code:
<body class="index">

All the other pages do not require a body class.

I've tried the following but it did not work;

Code:
<body <? if($_SERVER['REQUEST_URI'] == 'index'){echo 'class="index"';} ?>>

Any ideas?




body class on one page only - El Forum - 08-26-2013

[eluser]PravinS[/eluser]
check using uri segment

http://ellislab.com/codeigniter/user-guide/libraries/uri.html