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.

Switch in {categories}

March 18, 2010 4:23pm

Subscribe [2]
  • #1 / Mar 18, 2010 4:23pm

    Aetos

    3 posts

    Trying to do a basic switch and doesn’t appear to be working. I have been at it for 2hrs and need a fresh pair of eyes and someone with more knowledge.

    Here is my EE code

    {exp:channel:category_archive channel="knives" style="linear" show_empty="yes"}
    {categories}
    <div class="{switch='knife-main|knife-main-right'}">
    <a href="http://{path=knives/all-knives/}">{category_image}</a>
    <h2><a href="http://{path=knives/all-knives/}">{category_name}</a></h2>
    <p></div><br />
    {/categories}


    Here is the HTML Code

    <div class="{switch='knife-main|knife-main-right'}">
    <a href="http://www.waiteknives.com/index.php/knives/all-knives/category/hunting_knives">http://www.waiteknives.com/images/content/knife-gallery/main-hunting.jpg</a>
    <h2><a href="http://www.waiteknives.com/index.php/knives/all-knives/category/hunting_knives">Hunting Knives</a></h2>
    <p></div></p>
    
    <p><div class="{switch='knife-main|knife-main-right'}"><br />
    <a href="http://www.waiteknives.com/index.php/knives/all-knives/category/fishing_knives">http://www.waiteknives.com/images/content/knife-gallery/main-fishing.jpg</a></p><h2><a href="http://www.waiteknives.com/index.php/knives/all-knives/category/fishing_knives">Fishing Knives</a></h2>
    <p></div>

  • #2 / Mar 18, 2010 6:20pm

    Ingmar

    29245 posts

    I am afraid the switch variable is not available in all contexts. It works in the Weblog module, Comments, the Calendar, the Query module… but it’s not a global variable. Try using PHP here.

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

ExpressionEngine News!

#eecms, #events, #releases