Posted By

danielwrobert on 01/06/11


Tagged

php


Versions (?)

Check your body id with PHP


 / Published in: PHP
 

Previously, I posted a little snippet I found on how to generate a special body class on each .php page. I, later, needed to get that body class and echo out a piece of HTML, which depended on my current page. So here is the snippet that I came up with. Simple, but was useful for me.

  1. <?php
  2. $id = basename($_SERVER['PHP_SELF'], ".php");
  3. $register_btn = "<a class='btnRegister'>THIS CAN BE WHATEVER YOU WANT TO ECHO OUT.</a>";
  4.  
  5. if ($id != "workshops"){
  6. echo $register_btn;
  7. }
  8. ?>

Report this snippet  

Comments

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

thanks a lot...

You need to login to post a comment.