Page 1 of 1

Who's stupid, me or {cycle}?

Posted: Wed Aug 18, 2010 9:14 pm
by yellowled
I'm using this:

Code: Select all

{foreach from=$archives item="archive"}
      <div class="archive-year {cycle values="left,center,right"}">
      [...]
{/foreach}
to generate http://matthias.yellowled.de/archives/#bydate. Looking into the source, you'll notice that the classes actually start with .center instead of .left.

Is there something I don't see or why is cycle behaving unexpectedly here? :?

YL

Re: Who's stupid, me or {cycle}?

Posted: Thu Aug 19, 2010 9:26 pm
by Don Chambers
That does seem strange. Does it always start with the second one if you change the order? How about if you give it a name, ie {cycle name="blah" values="left,center,right"} How about single quotes instead of double since the class name is double quoted? I know these all sound like stupid suggestions, but I have seen some pretty crazy stuff fixed by some pretty unlikely things. :wink:

Re: Who's stupid, me or {cycle}?

Posted: Fri Aug 20, 2010 11:22 am
by yellowled
Don Chambers wrote:That does seem strange.
Erratic, too. Works like it's supposed to in my dev blog (which, however, has only three years).
Don Chambers wrote: Does it always start with the second one if you change the order? How about if you give it a name, ie {cycle name="blah" values="left,center,right"} How about single quotes instead of double since the class name is double quoted?
1. No, it doesn't, 2. generates the expected order and 3. doesn't do a thing. So giving the cycle a name fixes the problem, but why ..? Oh, hold on. I know.

The archive page's .tpl only uses this cycle, but it fetches the output of the categories plugin, which also uses a cycle. So it's two cycles in one page (which means they should be named), but in different .tpl files. Tricky.

Thanks for pushing me in the right direction! :)

YL

Re: Who's stupid, me or {cycle}?

Posted: Fri Aug 20, 2010 5:51 pm
by Don Chambers
Glad it worked out. Nice looking archive page too!