Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-05-27 22:27:55

WebKat
Member
Registered: 2007-01-16
Posts: 301

display/don't display if there is no next/prev article?

If I put the text “Next article:” or “Previous article:” before the link for txp:link_to_next or txp:link_to_prev it lets people know what the heck that link at the bottom of the article is for. Otherwise it just looks sort of out of place sitting down there below the comment box, seemingly with no relation whatsoever to the article currently being viewed. So putting that text there is a great solution. Except when there is no next or previous article, in which case I get the ever-so-silly looking “Next article:” with no link after it, which makes it look very sloppy or unfinished, or like I’ve made a mistake.

Is there a way to have a string show up if there is no next/prev article (such as “(none)”) or to have my “Next article:” text only show up if there is a next article, etc?



WebKat

Offline

#2 2007-05-27 22:45:36

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: display/don't display if there is no next/prev article?

Something like this? <txp:link_to_next>Next article: <txp:next_title /></txp:link_to_next>

Offline

#3 2007-05-28 01:32:32

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: display/don't display if there is no next/prev article?

Thanks! In an ideal world (you know, the one where I have a chocolate tree and my shoes are filled with money every morning when I wake up? That one?) I could make the “next article” text not linked, but this will work fine.



WebKat

Offline

#4 2007-05-28 01:37:57

atbradley
Plugin Author
From: Rhode Island, US
Registered: 2007-02-15
Posts: 34
Website

Re: display/don't display if there is no next/prev article?

If Els’s suggestion doesn’t work for you (it sounds like you don’t want your “Next article/Previous article” tags to be part of your links), you probably need the if_first_article and if_last_article tags. So, for example:

<txp:if_last_article> <!-- Nothing to see here. -->
<txp:else />Next article: <txp:link_to_next><txp:next_title /></txp:link_to_next>
</txp:if_last_article>

Offline

#5 2007-05-28 02:04:37

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: display/don't display if there is no next/prev article?

Ah ok. I may mess with that tomorrow when I am not drinking have more time. Thanks!!



WebKat

Offline

#6 2007-05-28 21:55:42

mikeg
Member
From: Edmonton, Canada.
Registered: 2005-02-21
Posts: 31
Website

Re: display/don't display if there is no next/prev article?

You can also go <txp:link_to_next showalways="1">Next Article</txp:link_to_next>. That’ll show the wrapped text even if there is no next article. If that’s what you’re getting at, anyways.


“I love Beethoven. Especially the poems.”
- Ringo Starr

Offline

#7 2007-05-28 22:43:44

WebKat
Member
Registered: 2007-01-16
Posts: 301

Re: display/don't display if there is no next/prev article?

No, I don’t want the text if there is no article.



WebKat

Offline

#8 2007-06-23 14:01:40

hhriebe
New Member
From: West Vancouver, BC, Canada
Registered: 2007-06-20
Posts: 8

Re: display/don't display if there is no next/prev article?

I tried this but for whatever reason <txp:if_first_article> returned false even though <txp:link_to_prev /> was blank. I.e. it worked for first+1 through last. The solution I already had in place wraps the text and links to be output in <txp:chh_if_data> – one for previous, one for next. Works fine.

Offline

#9 2007-06-29 16:53:40

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: display/don't display if there is no next/prev article?

Hi! Is there a way to make the next and previous links instead of the showing the “next_title” text, to display the next articles date?
like is I post on Jan23rd, and my last post was on Jan 22nd, have the next link be “JAN 22—>”??
Hope You guys can help me!

Offline

Board footer

Powered by FluxBB