ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

assigning colours to titles dynamically

September 27, 2007 11:07am

Subscribe [2]
  • #1 / Sep 27, 2007 11:07am

    Gary Carruthers

    28 posts

    First post so be gentle…

    The person managing the site wants to assign colours to titles of different sections on an ad hoc basis. My current hack is the following:

    Hex value is assigned to the ‘summary’ field in posts which is then used to style the title like so

    
    
    

    This works fine but it’s obviously a very inelegant solution. When I try to apply the same thinking to a category page the wheels come off. I have a list of titles which link to their posts and I’m trying to style them the same way but nothing seems to work. Amongst other things, I’ve tried the following

    
    
    

    Any suggestions would be very welcome.

    Gary.

  • #2 / Sep 27, 2007 1:13pm

    e-man

    1816 posts

    Remember that categories can have their own category custom fields as well, and those are available between the {exp:weblog:category_archive} tags. You should be able to use these to assign a colour to a category.

  • #3 / Sep 27, 2007 1:33pm

    Gary Carruthers

    28 posts

    Thanks for getting back e-man. Unfortunately it’s not the categories I’m trying to style, it’s the entry titles. Here’s the link: http://demo.pmachine.com/k5xU3/index.php/site/artists/

    A list of artists that are from a particular category and I want them to be coloured by their ‘summary’ field. I’ve got a feeling I’m going the extremely long way round.

  • #4 / Sep 27, 2007 1:49pm

    e-man

    1816 posts

    A list of artists that are from a particular category and I want them to be coloured by their ‘summary’ field.

    Why not use the standard weblog tag with category=”” then? That way your {summary} field is available.

  • #5 / Sep 27, 2007 2:52pm

    Gary Carruthers

    28 posts

    Yes, that makes more sense. I’ll give it a go.

  • #6 / Sep 27, 2007 3:49pm

    Gary Carruthers

    28 posts

    Worked a treat. Thanks for your help.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases