Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-02 16:14:15

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

if_different and blog archive

I wanted to see if I could power the archive of my mom’s blog with if_different. At the moment I’m doing it with custom PHP. I tried, but it doesn’t work out right. Maybe it is just not possible, but I wanted to check to see if maybe I’m just doing something wrong. If I can’t do this without it that’s fine, I just like the idea of dropping my various tweaks and hacks if I can. Desired result and attempt.

In my page, “test”:

<ul id="archive-list">
<txp:article_custom section="journal" form="archive" limit="9999" />
</ul>

In my form, “archive”:

<txp:if_different>
<li><h2><txp:posted format="%B %Y" /></h2>
<ul class="day-list">
</txp:if_different>

<txp:if_different>
<li><h3><txp:posted format="%d" /></h3>
<ul class="post-list">
</txp:if_different>

<li><a href="<txp:permlink />" rel="bookmark" title="Permanent link to &#8220;<txp:title />&#8221;"><txp:title /></a></li>

<txp:if_different>
</ul>
</li>
</txp:if_different>

<txp:if_different>
</ul>
</li>
</txp:if_different>

Offline

#2 2005-11-02 17:24:33

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: if_different and blog archive

Yes, you can’t have “enclosing” if_different stuff. This is because each block of <txp:if_different></txp:if_different> is evaluated by itself. So if you put a date in it, it will show when the date changes. If you put some fixed html in it, well the html will not change in the list, hence it is only shown the first time, and not after that.

Therefor my suggestion would be to drop the idea of using nested or multiple lists, and just output the line with the month so it can “stand on its own”.

To be able to handle nested lists, the tag would have to take a “key” seperate from what it displays. Doable, but more complex, not sure when this will become available.

Offline

#3 2005-11-02 18:23:13

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: if_different and blog archive

Yeah okay, I just felt “listy”. ;)

Offline

Board footer

Powered by FluxBB