klox7 VIP
Total posts: 914
22 Янв 2014 07:24

If I look at body class when on list view there is com_cobalt and view_records in it. Is it possible somehow to include section name also in this so I can independently style for ex. table article list template for every section without copying templates?

Ex. let's say I have 2 sections - Events and Reviews. For article list template I will use table template. Now if I look at table template it has classes. Those classes are same throughout this 2 sections.

What I would like to achieve is to have a parent class (ex. section name) somewhere to be able to style this template differently. So for this 2 sections css would be:

.events .table-records

.reviews .table-records

Последние изменения: 02 Март 2014


Sergey
Total posts: 13,748
22 Янв 2014 07:32

I did. In line 67 of template i added

section-section->id; ?>

into classes attribute.

I cannot use names because those can be non-latin. SO you have classe

table.section-1.table-records tr {}


pepperstreet VIP
Total posts: 3,837
22 Янв 2014 19:08

Good point. In general, the CSS classes and IDs should follow a certain scheme. Maybe also additional Cobalt name space for common classes to prevent collisions with 3rd-party templates and extensions. Fields and labels should also have their IDs etc.

Reminding me on this idea topic ;-)

BTW, a very good structured example is the K2 CSS. No, i am not a big fan of the product, just like their well written CSS.


klox7 VIP
Total posts: 914
23 Янв 2014 07:30

I seen today this in table class. Why don't you add it to body class="section-id". That way I can use core templates and custom templates for custom styling forever. If I changed core table template before this update I have to now manually fix it. If you add it to body class there is no need to fix custom templates. I can just start using body class.


Sergey
Total posts: 13,748
23 Янв 2014 07:53

Now tell me what do you mean by "body class"? ? Or what?


klox7 VIP
Total posts: 914
23 Янв 2014 08:03

Exactly...if I'm on Cobalt records list it goes for ex. like this

Why don't you include it here so it will be

?


Sergey
Total posts: 13,748
23 Янв 2014 22:52

As @pepperstreet had already mentioned we cannot affect body tag and add anything to it. It is out of Cobalt scope.

Solution to add class with javascript may result in little lags between styled being applied.

For this the only way is to hack your index.php of the template.

Работает на Cobalt