Fork me on GitHub
Subscribe 5

Ticket #1028 (open enhancement)

Add CSS classes to body tag

  • Created: 2015-04-02 21:24:56
  • Reported by: Lirodon
  • Assigned to: Studio384
  • Milestone: None
  • Component: templates
  • Priority: normal

As mentioned in, we were discussing the addition of per-page/per-forum class IDs to the body tag for semantics and possible use in themes.


Franz 2015-04-04 10:29:34

  • Milestone set to 1.5.9.

Oh, to the body tag?

I thought this was about the topic and post elements themselves!?

adaur 2015-06-17 21:19:04

We already have a <div id="punPAGE">, is it really necessary?

Franz 2015-06-18 15:59:05

Judging by the topic mentioned in the description, what's requested is IDs with the respective forum's / topic's ID, so that styles can be applied to a specific forum etc.

adaur 2015-06-18 17:06:23

OK. Why in <body> in particular? I would rather do

<div id="punindex" class="pun">
<div id="forumID" class="punwrap">

quy 2015-07-05 22:55:00

Should this be addressed in v1.6 with the templating system?


Will the following be a possible solution?

In main.tpl:

<div class="punwrap">

replace with

<div class="punwrap<pun_class>">

In header.php:

// START SUBST - <pun_class>
$tpl_main = str_replace('<pun_class>', (isset($css_class) ? ' '.$css_class : ''), $tpl_main);
// END SUBST - <pun_class>

In viewforum.php

$css_class = 'forum-'.$id;

Franz 2015-07-06 09:43:05

  • Milestone changed from 1.5.9 to 1.6.

Probably better suited for 1.6, I agree.

Studio384 2015-12-27 21:12:21

  • Owner set to Studio384.

Franz 2018-07-18 09:23:41

  • Milestone 1.6 removed.