Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End IF BODY ID

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #33896
    aoeui
    Participant

    hi guys,

    once more could use your knowledge

    I am php real beginner
    I am trying to achive in one common header.php + footer.php

    that is easy = 1 file, include far all pages

    do not know how to ECHO (or something) only .CSS + .JS for specific page
    because obivously there is no need to have lightbox.css / .jd + slider.css / .js on every page

    any hints how to do it?

    #84940
    chrisburton
    Participant

    I believe what you’re asking is how to dynamically use a header and footer? Use php includes

    #84944
    johnsonpr
    Member

    @krysak4ever i hope this solves ur issue:

    create a separate file namely xyz.php and in that file u can call ur scripts or css pagewise for example:


    if($url=="index.php"){















    }
    ?>

    And then in ur header.php just include the xyz.php file u created above, this way u dont need to even give an id to the body also

    Just remember one thing that u need to specify the full file name like index.php or gallery.php and not index/ or gallery/ which i guess you might be getting after you use the earlier .htaccess tip :)

    #84945
    johnsonpr
    Member

    @krysak4eve Sorry i just noticed that i made a mistake this would be the contents of the xyz.php file :P



    if($url=="index.php"){








    }

    if($url=="gallery.php"){







    }

    ?>

    #84968
    chrisburton
    Participant

    @krysak4ever – Aah, I understand what you mean. You need an if..else statement. Basically, if page equals index.php, display slider, Else, display lightbox. Is that exactly what you want?

    Questions:

    Are you using a CMS such as WordPress?

    What are the names of your .php pages?

    How many pages do you plan to have?

    #84977
    chrisburton
    Participant

    Why just those 2 files? Why not the whole header?

    #84980
    chrisburton
    Participant
    
    

    -Not sure how this is working when you have no php

    #84981
    chrisburton
    Participant

    @krysak4ever After reading through this, I’m very confused as is seems you want different things.

    What I think you want is to display a slider on one page and lightbox on the other, correct?

    #84983
    chrisburton
    Participant

    You could but honestly there’s no point to doing that. Either load slider.css or don’t

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.