Return to Snippet

Revision: 38724
at January 6, 2011 11:18 by danielwrobert


Initial Code
<?php
   $id = basename($_SERVER['PHP_SELF'], ".php");
   $register_btn = "<a class='btnRegister'>THIS CAN BE WHATEVER YOU WANT TO ECHO OUT.</a>";

   if ($id != "workshops"){
       echo $register_btn;
   }
?>

Initial URL

                                

Initial Description
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.

Initial Title
Check your body id with PHP

Initial Tags
php

Initial Language
PHP