SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast catch's Avatar
    Join Date
    Sep 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    giving a body id and using includes

    For CSS purposes how would i go about giving each page a diff. body id, right now i am using includes which includes the body so if i give it a id now it gives all the pages the same id, how can i make each page unique?

  2. #2
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ive used the filename as the body id before. Using basename($_SERVER['PHP_SELF']). Then stripping the extension.

  3. #3
    SitePoint Enthusiast catch's Avatar
    Join Date
    Sep 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok so i have

    <body id="<?php echo basename($_SERVER['PHP_SELF']); ?>">

    now it returns <body id="index.php">

    how do i remove the .php?
    Last edited by catch; Dec 13, 2007 at 10:11.

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by catch View Post
    ok i got it to work , but how would i strip off the .php extension?
    PHP Code:
    $filename basename($_SERVER['PHP_SELF']);
    list(
    $pageid) = split("\."$filename);
    echo 
    $pageid
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Enthusiast catch's Avatar
    Join Date
    Sep 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks it worked


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
  •