Skorpius

Get Page Function

May 25th, 2022 (edited)
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3.     $getPageName = function(){
  4.  
  5.             if($_SERVER["QUERY_STRING"] == ""){
  6.                 $pageName = "home";
  7.             }else{
  8.                 $filename = $_SERVER['QUERY_STRING'];
  9.                 $parts = explode("=",$filename);
  10.  
  11.                 $pageName = end($parts);
  12.             }
  13.             return $pageName;
  14.     };
  15.  
  16.     //Use $pageName in title on index.php to identify the page you are on. Put function in content area on index.php
  17. ?>
Add Comment
Please, Sign In to add comment