Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-09-29 12:47:15
- kishore
- Member
- Registered: 2005-09-29
- Posts: 14
excerpts
Hello!
I am trying to display excerpts on some of my articles. To do this I use two forms (as suggested by some of the resources I looked up). One form displaying just the message body while the other form displaying the excerpt. When I want an excerpt, I tried overriding the default form (with no excerpts tag) with the other form.
However, I am running into some funny problem when I use the <txp:article_custom>
tag. Somehow the form does not seem to get overridden. However, when I just use the <txp:article>
tag, the overriding occurs. Am I missing something here? Thanks!
Last edited by zem (2005-09-29 13:21:10)
Offline
Re: excerpts
Somebody suggested that I put this code into my signature. ;) You can use a single article form for excerpts or full posts and it is probably more stable and easier to understand. It will always show an excerpt if one is being used, or the full body if not, and always show the full body when viewing a single article.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2005-09-29 13:23:05
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: excerpts
article_custom ignores the ‘override form’ by design. For good reason: article_custom is commonly used to make a sidebar with title links to articles. If override_form worked, it’d mess up the sidebar.
Alex
Offline
#4 2005-09-29 13:33:50
- kishore
- Member
- Registered: 2005-09-29
- Posts: 14
Re: excerpts
Ok, thanks for the info. The reason I am using article_custom is because I want to display articles of a specific section on the page. Is there any way to achieve the same thing with just the article tag?
Offline
Re: excerpts
<code><txp:article /></code> is context-sensitive so it will only display articles in the currently viewed section or category. If you need to show articles on a page from a different section you will need to use <code><txp:article_custom /></code> so that you can specify the section you want the articles to come from. Try using a specific form for each tag. For the <code><txp:article /></code> tag use a form similar to the one I’ve linked to so that if you have an excerpt there it will be used automatically and for the <code><txp:article_custom /></code> use your excerpt only form so that you don’t need to use over-ride. If that doesn’t suit a little more detail of how and why you use them might be helpful.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#6 2005-10-01 08:14:10
- kishore
- Member
- Registered: 2005-09-29
- Posts: 14
Re: excerpts
Thanks for the input. Yes, I finally get it now. But, I am running into another problem. When I override the default form (which prints no excerpts) with one with which that provides excerpts, all works fine in the main page. The excerpts are displayed for the overridden forms. But, when I click on the links to the article, once again, only the excerpt is displayed, no article body.
Last edited by kishore (2005-10-01 08:14:37)
Offline
#7 2005-10-01 10:01:19
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: excerpts
The excerpts are displayed for the overridden forms. But, when I click on the links to the article, once again, only the excerpt is displayed, no article body.
Well, yes, because you’re overriding the form with one that prints (only?) the excerpt.
Alex
Offline
#8 2005-10-01 14:06:44
- kishore
- Member
- Registered: 2005-09-29
- Posts: 14
Re: excerpts
OK, I think I did not explain myself clearly there. This is what I am trying to do: Most of my articles are short. However, some of them are quite long, so when that happens, I want to display only the excerpt of the long articles on the main page. When the title of the article with the excerpt is clicked, the article page should contain the entire body of the article. This was what I was trying to do above by overriding the default form (with no excerpt tag) with a another form (with excerpt tag). However, what happens now is that although the excerpt of the article shows up correctly on the main page, upon clicking the link, the full body of the article is not seen. Once again, only the excerpt is seen. Am I doing something (or everything) wrongly here?
Offline
Re: excerpts
You shouldn’t need to use over-ride which is what zem is saying. If you use over-ride then it will over-ride in article_list AND individual_article views. With my form above, when you are in article_list view it will show an excerpt if you have one and if you don’t it will show the full body, but when you go to individual_article view it will always show the body. No over-ride is needed. If you still aren’t sure then post your page template code here so we can see it, putting it in between < code>< /code> tags (without the spaces).
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#10 2005-10-01 22:36:34
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: excerpts
The FAQ explains how to do the excerpt/body thing. Override Form is not the right tool for the job.
Alex
Offline
#11 2005-10-02 03:33:45
- kishore
- Member
- Registered: 2005-09-29
- Posts: 14
Re: excerpts
Oh ok. Thanks people. I finally got the thing done. I was missing the <code> <txp:else /> </code> tag.
Last edited by kishore (2005-10-02 03:50:50)
Offline