Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-13 00:43:42

edemay
Member
From: Montréal
Registered: 2005-08-16
Posts: 27
Website

links+longposts à la kottke with new tags

I am looking into having my linklog mixed in with my regular longer posts like kottke.org (though i’m adding to the mix photos as well) – so 3 different sections on the frontpage.

Having them showing up one after the other on the front page isn’t hard, textpattern handles that easily. What seems to be harder is (and like Ramanan <a href=“http://funkaoshi.com/debug/build-a-link-log”>has worked on</a>) is the visual link between them. My sperator is like kottke’s, a horizontal rule <hr /> only displayed between the different sections (the article and photo posts always finish with this horizontal rule though). So what I want is: article post, <hr />, linkpost, linkpost, linkpost, <hr />, photopost, <hr />, linkpost, linkpost, linkpost, <hr />, etc…

Using the new tags in textpattern, i managed to make a simple article form that displays the different forms for each. So now I want to add this <hr /> tag only when the section changes, not between every post.

I’m using Ramanan’s plugin <a href=“http://funkaoshi.com/blog/if-section-different-plugins”>If_prev_section_different</a> and it doesn’t seem to work properly, putting a horizontal rule after every post…

Now is there a way to do this natively in textpattern? Meybe with the <txp:if_different> tag (working with sections and not by date)??

<ul>
<li>Here is the test page with mock-up text: <a href=“http://www.hippopocampe.org/text/”>hippopocampe.org/text/</a></li>
<li>Here is the code for my default article display:</li></ul>

<code>
<txp:if_article_section name=“links”>
<p>
<txp:body />
<txp:permlink>#</txp:permlink>
<txp:comments_invite />
</p>
</code>

currently then this:<code>
<txp:rsx_if_prev_section_different>
<hr />
</txp:rsx_if_prev_section_different>
</txp:if_article_section>
</code>

but maybe this somehow instead:<code>
<txp:if_different>
<hr />
</txp:if_different>
</txp:if_article_section>
</code>

then finishing with:
<code>
<txp:if_article_section name=“articles”>
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:body /></p>
<hr />
</txp:if_article_section></code>
<code>
<txp:if_article_section name=“photos”>
<small class=“imgsidenote”>
<span class=“smalltitle”><txp:title /></span>
<txp:excerpt />
</small>
<div class=“images”><txp:body /></div>
<hr />
</txp:if_article_section>
</code>

Last edited by edemay (2006-01-13 00:46:52)

Offline

#2 2006-01-13 01:08:51

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: links+longposts à la kottke with new tags

Yeah, I do the exact same thing with my site, and hadn’t implemented the rules – but it’s pretty simple. if_different just needs something between it’s opening and closing tags to have changed from the previous article, so try this:

<code>
<txp:if_different><!— <txp:section /> —>
<hr/>
</txp:if_different>
</code>

I made it work on my website, but I won’t promise anything ;)

Last edited by misterk (2006-01-13 01:14:54)

Offline

#3 2006-01-13 02:06:20

edemay
Member
From: Montréal
Registered: 2005-08-16
Posts: 27
Website

Re: links+longposts à la kottke with new tags

Almost there but no quite. Misterk, your suggestion kinda works but only for the first links at the top, then nada. Txp doesn’t realize the previous articles are in a different section. I wonder if it’s not in the way it handles the display command cause of the <txp:if_article_section name="blabla"> tags…

Page displayed here <a href=“http://www.hippopocampe.org/text”>www.hippopocampe.org/text</a>

here is the code now:
<code>
<txp:if_article_section name=“links”>
<txp:if_different><!— <txp:section /> —>
<hr/>
</txp:if_different>
<p>
<txp:body />
<span class=“postinfo”>
<txp:permlink>#</txp:permlink>
<txp:comments_invite />
</p>
</txp:if_article_section>
</code>
<code>
<txp:if_article_section name=“articles”>
<hr />
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:body /></p>
</txp:if_article_section>
</code>
<code>
<txp:if_article_section name=“photos”>
<hr />
<small class=“imgsidenote”><span class=“smalltitle”><txp:title /></span><txp:excerpt /></small>
<div class=“images”><txp:body /></div>
</txp:if_article_section>
</code>

Last edited by edemay (2006-01-13 02:08:49)

Offline

#4 2006-01-13 02:37:15

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: links+longposts à la kottke with new tags

I enabled it for my site again, and it seems to go all the way to the bottom of the page.

I have it set up with a date_header form which is included at the top of each article form, and has two txp:if_different statements: one for the date, and (the above) one for the breaks between sections.

Maybe if you took your txp:if_different out from txp:if_article_section name="links" and just put it at the top of the form? Then you wouldn’t need the plain hrs coded into the other two, unless you always want an hr between articles and photos, and just not between link entries…

You could mess around with the txp:else clause maybe.

Offline

#5 2006-01-13 02:51:20

edemay
Member
From: Montréal
Registered: 2005-08-16
Posts: 27
Website

Re: links+longposts à la kottke with new tags

BINGO! I got it – and i still got the HR around the articles and photos (!). Thanks a bunch for your help misterk.

Txp, à la kottke, no plugins necessary:

<code>
<txp:if_different><!— <txp:section /> —>
<txp:if_article_section name=“links”>
<hr/>
</txp:if_article_section>
</txp:if_different>
</code>
<code>
<txp:if_article_section name=“links”>
<p>
<txp:body />
<span class=“postinfo”>
<txp:permlink>#</txp:permlink>
<txp:comments_invite />
</p>
</txp:if_article_section>
</code>
<code>
<txp:if_article_section name=“articles”>
<hr />
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p><txp:body /></p>
</txp:if_article_section>
</code>
<code>
<txp:if_article_section name=“photos”>
<hr />
<small class=“imgsidenote”><span class=“smalltitle”><txp:title /></span><txp:excerpt /></small>
<div class=“images”><txp:body /></div>
</txp:if_article_section>
</code>

Offline

#6 2006-01-13 03:32:34

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: links+longposts à la kottke with new tags

No problem, can’t wait to see the site launch.

Textpattern rocks so much.

Offline

#7 2006-01-13 15:44:15

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: links+longposts à la kottke with new tags

Glad to see you got it working. I’ll need to give the if_different tags another shot at some point as well. I couldn’t get things working with them when I tried to use them many moons ago.

Offline

#8 2006-04-22 13:05:47

Jaro
Member
From: S/F
Registered: 2004-11-18
Posts: 89

Re: links+longposts à la kottke with new tags

This works great, exactly what I needed except of one thing. I can’t figure out how to remove hr from the top entry. You know, I don’t want list of articles start with hr tag. Any ideas? I played around with if_first_article but it seems like it can’t be done with such a tag combination.

Offline

#9 2006-04-22 16:37:37

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: links+longposts à la kottke with new tags

<a href=“http://textpattern.net/wiki/index.php?title=Txp:if_first_article” title=“Txp:if first article”>txp:if_first_article</a> would probably let you work around that.

Offline

#10 2006-04-23 09:48:24

Jaro
Member
From: S/F
Registered: 2004-11-18
Posts: 89

Re: links+longposts à la kottke with new tags

Yes, Elenita, that’s what I was thinking too (see my previous post). I figured it out finally.

<code>
<txp:if_first_article>
<txp:if_article_section name=“links”>
here goes your links form
</txp:if_article_section>
</code>

<code>
<txp:if_article_section name=“articles”>
<hr />
here goes your article form
</txp:if_article_section>
</code>

<code>
<txp:else />
</code>

<code>
<txp:if_different><!— <txp:section /> —>
<txp:if_article_section name=“articles”>
<hr />
</txp:if_article_section>
</txp:if_different>
</code>

<code>
<txp:if_article_section name=“links”>
here goes your links form
</txp:if_article_section>
</code>

<code>
<txp:if_article_section name=“articles”>
here goes your article form
<hr />
</txp:if_article_section>
</txp:if_first_article>
</code>

Offline

Board footer

Powered by FluxBB