Postings

You can freely browse the forum and post in the community forum.
However, you need a valid license to write posts for support (own a valid commercial software license or have purchased a support membership).

Posts only show once reviewed. This is mainly preventive to keep spam away. Thank you for your understanding!

How To Give Each Category an ID

  • MyWorld
  • MyWorld's Avatar Topic Author
  • Senior Member
  • Senior Member
More
IP: 70.27.106.234 5 years 3 months ago #5477 by MyWorld
I am using different categories and sometimes I want a bit of a different style for each category.  Is there a way to give each category an ID?

Thanks!
  • syw
  • syw's Avatar
  • Administrator
  • Administrator
More
IP: 90.26.174.234 5 years 3 months ago #5484 by syw
Replied by syw on topic How To Give Each Category an ID
You can already differentiate contacts by category.

Each contact has classes:
person
personid-{the contact id}
catid-[the category id]

You can use those classes and CSS to modify the look of your contacts depending on the categories they belong to.

For instance, use

.person.catid-10 { font-size: 10px }

to change the font size of contacts being members of the category that has id 10.

Olivier.
  • MyWorld
  • MyWorld's Avatar Topic Author
  • Senior Member
  • Senior Member
More
IP: 70.27.106.234 5 years 3 months ago #5485 by MyWorld
I see the personid-## and the catid-## via Firebug, that you are referring. I was hoping that there would be an ID on the DIV that contains the contacts. For example, in the form#trombinoscopeForm, you would have something like this:

<div id="personlist" class="personlist">

Maybe we could add the ID via the category in the backend. I'm not as smart as you so you would know how best to do it but I think each category should have it's own ID.

Thanks :)
  • syw
  • syw's Avatar
  • Administrator
  • Administrator
More
IP: 90.26.174.234 5 years 3 months ago #5486 by syw
Replied by syw on topic How To Give Each Category an ID
It's not possible to add a category id to personlist since personlist can be a group of contacts from different categories. That would only work if contacts were of the same category. In which case, why the need to differentiate by category?

If you are using modules, each module instance has its own id, that is how you can differentiate several module instances on a page. If contacts are of the same category in each module instance, it's easy to differentiate them from each other.

To change the look of contacts with different categories in a single module instance or in a menu item, catid_[id] is the only way to go.

Olivier.