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.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


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) »
  • Templates, Menus & Design »
  • TIP: Stylesheets for individual pages
  • Print
Pages: [1]   Go Down

Author Topic: TIP: Stylesheets for individual pages  (Read 4562 times)

FruitBatInShades

  • Guest
TIP: Stylesheets for individual pages
« on: April 21, 2008, 12:20:24 PM »
I am using articles on my website that need stylesheets for individual pages (demoing css techniques) but couldn't find an easy way to do this through WB. If there is a way please let me know, but if not here is my tip.

In the template I add the following to the body tag:

<body class="<?php echo ereg_replace("[^A-Za-z0-9]", "", PAGE_TITLE); ?>">


then you can access items on a page by page basis :-

body.pagename h1{}
body.pagename2 h1{}


and if you require individual stylesheets you can add the following to the header and create pagename.css in the template directory:

<link rel="stylesheet" type="text/css" media="all" href="<?php echo TEMPLATE_DIR; ?>/<?php echo ereg_replace("[^A-Za-z0-9]", "", PAGE_TITLE); ?>.css" />
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: TIP: Stylesheets for individual pages
« Reply #1 on: April 21, 2008, 05:51:36 PM »
There were other posts on this forum on this issue.

A nice way is using the PAGE_ID of WB to load a different CSS on a single page.
Have a look at https://forum.WebsiteBaker.org/index.php/topic,9284.0.html

It does not need understanding of regex and does the same job as your last example.

Ruud
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline DGEC

  • Posts: 388
  • Gender: Male
    • EbelTech homepage
Re: TIP: Stylesheets for individual pages
« Reply #2 on: April 21, 2008, 08:05:14 PM »
If someone needs a simple way of using a different stylesheet without coding, don't forget you can go to the settings for the page and change the template from "system default" to whichever one you want.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • TIP: Stylesheets for individual pages
 

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