Who's stupid, me or {cycle}?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Who's stupid, me or {cycle}?

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post 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:
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

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

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers »

Glad it worked out. Nice looking archive page too!
=Don=
Post Reply