WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Include CSS, JS etc by Page
  • Print
Pages: [1]   Go Down

Author Topic: Include CSS, JS etc by Page  (Read 8952 times)

vark

  • Guest
Include CSS, JS etc by Page
« on: December 07, 2008, 09:11:35 PM »
I'm a complete neophyte when it comes to php, so it took me months to figure this out.  For those who haven't got this already, here's a solution:

<?php if (PAGE_ID  ==  '2') { ?>
    <link href="<?php echo WB_URL; ?>/styles/home.css" rel="stylesheet" type="text/css" media="screen" />

<?php } else if (PAGE_ID  ==  '3') { ?>
    <link href="<?php echo WB_URL; ?>/styles/page2.css" rel="stylesheet" type="text/css" media="screen" />
   
<?php } else  $list = array('4', '5', '6');
              if (in_array (PAGE_ID, $list)) { ?>
    <link href="<?php echo WB_URL; ?>/styles/pages4to6.css" rel="stylesheet" type="text/css" media="screen" />

<?php } ?>

Page_id can be found in the web address of a given page during an edit session in WB admin (http://yourpage.org/admin/pages/modify.php?page_id=2).
Logged

Offline Bramus

  • Posts: 608
  • Gender: Male
    • BRAMUS Internet Services
Re: Include CSS, JS etc by Page
« Reply #1 on: December 07, 2008, 09:31:27 PM »
Thanks for posting, but i think this has already been posted here a few times only for a different header, a simple edit by that script would have done the same as you posted here, so you could save a month of work by searching a bit or asking for help :P

Btw can you place the code in the code tag?
Logged
BRAMUS Internet Services

vark

  • Guest
Re: Include CSS, JS etc by Page
« Reply #2 on: December 07, 2008, 09:38:59 PM »
Hi Bramus,
Sorry to have recapitulated something already posted.  Could you point me towards the other post?  Thanks.
Logged

doc

  • Guest
Re: Include CSS, JS etc by Page
« Reply #3 on: December 07, 2008, 10:33:09 PM »
@vark:
Some of the hits mentioned by Bramus could be found by using the advanced forum search and keywords: CSS page_id

Regards Christian
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Include CSS, JS etc by Page
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2