Posted By

danielwrobert on 01/05/11


php body-id

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Add a unique ID to to the body element with PHP

 / Published in: PHP


From an awesome comment on how you can use PHP to apply the unique ID to to the body element. This will return the name of the PHP file being executed as the ID (e.g. body id="index.php"). To leave off the .php part, just remove the ".php" part.

  1. <body id="<?= basename($_SERVER['PHP_SELF'], ".php")?>">

Report this snippet  


RSS Icon Subscribe to comments
Posted By: geetshah on June 27, 2014

thanks a lot...

You need to login to post a comment.