Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 10:53:42 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155470 Posts in 21707 Topics by 7734 Members
Latest Member: rofroodoOvego
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Include CSS, JS etc by Page  (Read 1873 times)
vark

Offline Offline

Posts: 3


« 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
Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« 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 Tongue

Btw can you place the code in the code tag?
Logged

BRAMUS Internet Services
vark

Offline Offline

Posts: 3


« 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
« 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
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!