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 class problems in EE 2

December 04, 2010 8:26pm

Subscribe [2]
  • #1 / Dec 04, 2010 8:26pm

    Franka

    54 posts

    Hi,

    ExpressionEngine v2.1.1

    I’m using Magpie 1.3.5 to get newsfeed in my website.
    I try to use switch to get different colors on line 1 and 2:

    {exp:magpie url="http://www.news.xx" limit="4" refresh="60" convert_entities="y" convert_encoding="y" encoding="iso-8859-1"}
    {items}
    <a href="http://{link}" class="{switch=green|gray}" target="_blank" rel="noopener">{title}</a>
    
    {/items}
    {/exp:magpie}

    I tried:

    {exp:magpie url="http://www.news.xx" limit="4" refresh="60" convert_entities="y" convert_encoding="y" encoding="iso-8859-1"}
    {items}
    <div class="{switch='green|gray'}">
    <a href="http://{link}" target="_blank" rel="noopener">{title}</a>
    
    </div>
    {/items}
    {/exp:magpie}

    In my css I have:

    .green {font: 9px/13px Arial, Helvetica, Geneva, sans-serif;
        color: #b4feb2;}
    .gray {font: 9px/13px Arial, Helvetica, Geneva, sans-serif;
        color: silver;}

    it won’t work, I even tried

    {if count =="1"}<a href="http://{link}" class="green" target="_blank" rel="noopener">{title}</a>{/if}
    {if count =="2"}<a href="http://{link}" class="gray" target="_blank" rel="noopener">{title}</a>{/if}

    Can anybody help me, I searched on the internet but I cann’t find an answer.

    kind regards
    Franka

  • #2 / Apr 27, 2011 6:11pm

    Franka

    54 posts

    Hello,

    Did you ever find a solution to using magpie and switching styles? I am having a similar problem.

    Regards,
    Marc

    Hi,
    I had to think hard to find the website with that problem. And because I had solved it, it was out of my system wink
    But I found it: I exchanged magpie for feedparser. I hope you can use my solution.

    regards,
    Franka

    in templete:
    <table id=“nws” width=“100%” border=“0” cellspacing=“0” cellpadding=“0”>
      <td valign=“top”>
    {exp:ajw_feedparser url=“http://www.news.xx/rss/music” cache_refresh=“10” limit=“6”}
    {title}
    {/exp:ajw_feedparser}
    </td>
      </td>
      </tr>
    </table>

    in css:
    .nws_even a:link {
    color: white;
    background-color: transparent;
    width: 226px;
    display: block;
    height: 14px;
    overflow: hidden;
    font-size: 9px;
    font-weight: bold;
    }

    .nws_even a:visited {
    color: #eee;
    background-color: transparent;
    }

    .nws_even a:hover {
    background-color: #333;
    }

    .nws_even a:active {
    }

    .nws_oneven a:link {
    color: #01ff04;
    background-color: transparent;
    width: 226px;
    display: block;
    height: 14px;
    overflow: hidden;
    font: bold 9px Arial, Helvetica, Geneva, sans-serif;
    }

    .nws_oneven a:visited {
    color: #01ff04;
    background-color: transparent;
    }

    .nws_oneven a:hover {
    background-color: #333;
    }

    .nws_oneven a:active {
    }

  • #3 / May 05, 2011 9:33pm

    e-man

    1816 posts

    Have a look at :nth-child css selectors:
    http://reference.sitepoint.com/css/pseudoclass-nthchild

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

ExpressionEngine News!

#eecms, #events, #releases