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 »
  • Current page ID/Class in body tag
  • Print
Pages: [1]   Go Down

Author Topic: Current page ID/Class in body tag  (Read 5410 times)

markywatts

  • Guest
Current page ID/Class in body tag
« on: June 19, 2009, 11:48:41 AM »
Hi,

I need to set an ID or Class in the say the body tag, that identifies what page you are on.  So I can then apply some css thats specific to that page.  What code do I add to the template?

Thanks
Marky
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Current page ID/Class in body tag
« Reply #1 on: June 19, 2009, 12:13:38 PM »
Hello,

use:

<body id="<?php echo $page_id; ?>">

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline BerndJM

  • Posts: 1764
  • Gender: Male
Re: Current page ID/Class in body tag
« Reply #2 on: June 20, 2009, 01:12:11 AM »
Sorry Stefek,
but numeric id's are not allowed.
Specially the IE may show some strange behavior if a id starts with a number.
So
Code: [Select]
<body id="p<?php echo $page_id; ?>">would be the better way.

Regards Bernd
Logged
In theory, there is no difference between theory and practice. But, in practice, there is.

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Current page ID/Class in body tag
« Reply #3 on: June 20, 2009, 12:57:07 PM »
Of course, Bernd - you're right.

You have to use a prefix beforehand.
It's because CSS won't allow numbers at the beginning of the class/id.

Regards,
Stefek


« Last Edit: June 20, 2009, 01:00:24 PM by Stefek »
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

markywatts

  • Guest
Re: Current page ID/Class in body tag
« Reply #4 on: June 23, 2009, 07:37:35 AM »
Brilliant thanks! works like a dream.
Cheers
Marky
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Current page ID/Class in body tag
 

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