+ Reply to Thread
Results 1 to 2 of 2

Thread: Identify current page and apply rules to it

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    14

    Identify current page and apply rules to it

    Say i got two pages , how can i identify the pages and apply rules to each page like displaying a text or content ?
    Last edited by archer; 11-12-2012 at 03:26 AM.

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    41
    So you got a series of PHP Pages and would like to identify the current page and apply rules or even display content inside it.

    Step 1 : [Identify Script name]
    Code:
    $script     = explode('/', $_SERVER['PHP_SELF']);
    $scriptname = $script[count($script) - 1];
    Step 2 : [crate a switch statment]
    Code:
    switch ($scriptname) {
        case "page1.php":
            // display some content here if it is page 1
        break;
    
        case "page2.php":
            // display some content here if it is page 2
        break;
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts