Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-05-02 05:00:58
- dave halliday
- Member
- Registered: 2008-02-29
- Posts: 16
Processing excerpts
I am very much a TXP newbie but have not seen what I am looking for through searching or reading the FAQs. I have a copy of Textpattern Sollutions and didn’t see anything in that.
I am building this website with TXP: http://www.crossroadsgrocery.com
I have a section (Origins) and plan a number of articles in that section.
Rather than have the articles form a very long section, I would like to have a bunch of short excerpts and the user can either
#1) – click on a “Read More” or on the title of the excerpt and that article would expand out into the full article.
or
#2) – click on a “Read More” or on the title of the excerpt and have that article open in a new browser window.
I have the suspicion that this should be straightforward but I’m missing it for now. I looked through the plug-ins and these seemed more oriented towards generating excerpts.
Thanks you!
Dave
Offline
#2 2008-05-02 05:15:07
- Ruhh
- Member
- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: Processing excerpts
You can use a few TXP tags to achieve that:
<txp:if_article_list>
<txp:if_excerpt>
<txp:excerpt />
<a href="<txp:permlink />#body">Read More</a>
<txp:else />
<txp:body />
</txp:if_excerpt>
<txp:else />
<txp:if_excerpt>
<txp:excerpt />
</txp:if_excerpt>
<txp:body />
</txp:if_article_list>
This would go in your default form.
Last edited by Ruhh (2008-05-02 05:15:50)
<txp:Ruhh />
Offline
#3 2008-05-03 05:37:05
- dave halliday
- Member
- Registered: 2008-02-29
- Posts: 16
Re: Processing excerpts
Where should these tags be placed. I tried putting them in several places in the <!— center —> section of the default page presentation code and didn’t get the desired effect. (didn’t get any effect actually.)
The article in question does have an excerpt that I entered.
Many thanks!
Dave
Offline
Re: Processing excerpts
They don’t go into a page template, they go into a form template and that form is then called by the <txp:article />
or <txp:article_custom />
tag in your page template using the “form” attribute like so – <txp:article form="formName" />
.
If your <txp:article />
or <txp:article_custom />
tags aren’t using the “form” attribute they are calling the “default” form template so that is where you should make the appropriate alterations or create a new form and add the “form” attribute to the tags.
Last edited by thebombsite (2008-05-03 10:59:25)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#5 2008-05-04 04:49:17
- dave halliday
- Member
- Registered: 2008-02-29
- Posts: 16
Re: Processing excerpts
Thanks to all of you — got it working tonight and it’s great! Forms are cool as I can have it running on just the sections that I want and not have it affect the entire site…
http://www.crossroadsgrocery.com/origins/
Now, is there a quick way to do a “Read Less” option?
I can probably figure this out but I am guessing that there is a code snippet floating around and would appreciate having it sent my way.
Thanks again!
Dave
Offline
Re: Processing excerpts
Read less? Visitors can just stop reading if they’ve had enough ;)
Offline
Re: Processing excerpts
Well that depends on what you mean by “read less”. If you mean someone is reading the full, individual article and you want a link back to the “frontpage” of a section you could use something like <a href="<txp:site_url /><txp:section />">Back</a>
or variations of it depending on where you need to get back to.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Pages: 1