Posted By

iTony on 05/14/08


Tagged

simple function id body


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

romanos


simple Body ID Function


 / Published in: PHP
 

  1. <?php
  2. function setBodyId() {
  3. $path = $_SERVER['REQUEST_URI'];
  4.  
  5. if(!isset($bodyId)) {
  6. if(eregi(’^/about/,$path) == 1) {
  7. $bodyId = ‘about’;
  8. } else if(eregi(’^/blog/,$path) == 1) {
  9. $bodyId = ‘blog’;
  10. } else if(eregi(’^/contact/,$path) == 1) {
  11. $bodyId = ‘contact’;
  12. } else if(eregi(’^/work/,$path) == 1) {
  13. $bodyId = ‘work’;
  14. } else if(eregi(’^/play/,$path) == 1) {
  15. $bodyId = ‘play’;
  16. } else if ($path ==) {
  17. $bodyId = ‘home’;
  18. } else {
  19. $bodyId = ‘general’;
  20. }
  21. }
  22.  
  23. return $bodyId;
  24. }
  25.  
  26. $bodyID=setBodyId();
  27. ?>
  28.  
  29. <body id="<?=$bodyID?>">

Report this snippet  

You need to login to post a comment.