Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Help Needed: Article Display List
Greetings All,
I’m quite new to textpattern, and I’m currently trying out Textpattern offline. As such, I would like to implement a custom article listing on the front page of my textpattern install, such that I show only the recent 5 articles posted into the section /articles, and would like to use the TXP equivalent for the following HTML code :
<!— Start .featured_posts —> <div class=“clearfloat”>
<h3 class=“cat_title”><a href=”#” title=“View all posts in Category” >Category Name</a> » </h3> <div class=“title”><a href=”#” rel=“bookmark”>Article Title Here</a></div> <div class=“meta”>[31 Dec 2008 | <a href=”#” title=“Comment on Article”>15 Comments</a> | 3,115 views]</div>
<div class=“brief”>
<a href=”#” rel=“bookmark” title=“Permanent Link to Article”>
<img src=“images/front/images.jpg”
alt=“Image Alt Text” class=“left” width=“150px” height=“150px” /></a>
<p>Nulla faucibus erat non pede. Pellentesque imperdiet, diam ut elementum aliquet, mi felis placerat risus, at iaculis nisl enim nec purus. Donec dictum pede at risus. <br /> Vivamus pretium molestie lorem. Aliquam erat volutpat. Phasellus eleifend, turpis a laoreet pretium, orci urna porta turpis, id sagittis est urna gravida eros. Donec gravida. Nam vehicula vestibulum mauris. Nullam rutrum adipiscing ligula. Mauris ut leo at nisi feugiat ultrices.</p> </div>
</div>
Your assistance, advise, and input will be highly appreciated.
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
The Code [ Properly Formated ]:
<code>
<!— Start .featured_posts —>
<div class=“clearfloat”>
<h3 class=“cat_title”>
<a href=”#” title=“View all posts in Category” >Category Name</a> »
</h3>
<div class=“title”>
<a href=”#” rel=“bookmark”>Article Title Here</a>
</div>
<div class=“meta”>[31 Dec 2008 | <a href=”#” title=“Comment on Article”>15 Comments</a> | 3,115 views]</div>
<div class=“brief”>
<a href=”#” rel=“bookmark” title=“Permanent Link to Article”>
<img src=“images/front/images.jpg”
alt=“Image Alt Text” class=“left” width=“150px” height=“150px” />
</a>
<!— Start Article Excerpt —>
<p>Nulla faucibus erat non pede. Pellentesque imperdiet, diam ut elementum aliquet, mi felis placerat risus, at iaculis nisl enim nec purus. Donec dictum pede at risus. <br />
Vivamus pretium molestie lorem. Aliquam erat volutpat. Phasellus eleifend, turpis a laoreet pretium, orci urna porta turpis, id sagittis est urna gravida eros. Donec gravida. Nam vehicula vestibulum mauris. Nullam rutrum adipiscing ligula. Mauris ut leo at nisi feugiat ultrices.</p>
<!— End Article Excerpt —>
</div>
</div>
</code>
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
quemultimedia wrote:
I would like to implement a custom article listing on the front page of my textpattern install, such that I show only the recent 5 articles posted into the section /articles
This might be more basic an answer than you were looking for, but I’m not sure how far along you are yet.
To get the front (home) page to show the articles you want, you need <txp:article_custom section="articles" limit="5" />
at the appropriate place in your default page. By default this will show the most recent articles from that section, listed from newest to oldest.
Additionally, you will most likely want to wrap that article_custom
tag in conditional tags, because article_custom
is not context-sensitive. That is, it is going to display those 5 articles for any view using the default page, such as search results and category lists, where you probably don’t want them. Using native TXP tags might look like this:
<txp:if_search> <!-- tags to format your search results --> <txp:else /> <txp:if_category> <!-- tags to format your category listings --> <txp:else /> <txp:article_custom section="articles" limit="5" /> </txp:if_category> </txp:if_search>
Or you could find a plugin with a conditional tag for the equivalent of if_frontpage or if_homepage.
Code is topiary
Offline
Re: Help Needed: Article Display List
Thanks a great deal. Will try this out. However, just another rough question, how do I format the article’s output as above? I would like to have the above ‘custom’ output for the content.
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
You do the article formatting in a form (Presentation->Forms). Modify the article tag like so:
<txp:article_custom section="articles" limit="5" form="featured" />
Then create a new article form called “featured”. All of the code you have posted above goes in that form (assuming you want this repeated for each of the five articles in the list). To display the category, title, excerpt, etc. for each article, you use TXP tags such as <txp:category1 />
, <txp:title />
, <txp:excerpt />
, etc. Check the TextBook section on article tags to see the possibilities.
Code is topiary
Offline
Re: Help Needed: Article Display List
Thanks a great deal guys….now trying to come up with the TXP equivalent of the above code…
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
Guys,
After reading the I came up with the following TXP equivalent for the above code. Though it’s partly working, I’m having the following problems:
- Article Image isn’t showing
- Excerpt text has lost all prior formatting [the above HTML chunk is part of the HTML page that I’m trying to ‘port’ to TXP].
bc..
<!— Start .featured_posts —>
<div class=“clearfloat”>
<h3 class=“cat_title”><txp:category1 link=“1” title=“1” /> » </h3>
<div class=“title”><txp:permlink><txp:title /></txp:permlink></div>
<div class=“meta”>[<txp:posted format=”%b %d, %Y” /> | <txp:if_comments> | <txp:comments_invite showcount=“0” /> | <txp:comments_count /> Comments
</txp:if_comments>]</div>
<div class=“spoiler”>
<txp:permlink><txp:article_image thumbnail=“1” class=“article-image” /></txp:permlink>
<txp:if_excerpt> <txp:excerpt /> <p class=“read-more”> <a href=”<txp:permlink />#body” title=”<txp:title />”>» Read more</a> </p> <txp:else /> <txp:body /> </txp:if_excerpt>
</div>
</div>
<!— end .featured_posts —>
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
Guys,
After reading up on the advised section I came up with the following TXP equivalent for the above code. Though it’s partly working, I’m having the following problems: – Article Image isn’t showing – Excerpt text has lost all prior formatting [the above HTML chunk is part of the HTML page that I’m trying to ‘port’ to TXP].
bc..
<code>
<!— Start .featured_posts —> <div class=“clearfloat”> <h3 class=“cat_title”><txp:category1 link=“1” title=“1” /> » </h3> <div class=“title”><txp:permlink><txp:title /></txp:permlink></div> <div class=“meta”>[<txp:posted format=”%b %d, %Y” /> | <txp:if_comments> | <txp:comments_invite showcount=“0” /> | <txp:comments_count /> Comments
</txp:if_comments>]</div> <div class=“spoiler”>
<txp:permlink><txp:article_image thumbnail=“1” class=“article-image” /></txp:permlink>
<txp:if_excerpt> <txp:excerpt /> <p class=“read-more”> <a href=”<txp:permlink />#body” title=”<txp:title />”>» Read more</a> </p> <txp:else /> <txp:body /> </txp:if_excerpt>
</div>
</div>
<!— end .featured_posts —>
</code>
Que,
Que-Multimedia
Offline
Re: Help Needed: Article Display List
quemultimedia wrote:
Article Image isn’t showing – Excerpt text has lost all prior formatting
Not sure what formatting you mean, but make sure that the Textile option for the excerpt is set appropriately.
As to the image, have you indeed assigned the article an image (see link above), and does that image have a thumbnail? When you assign the image to the article, are you using the image ID?
Code is topiary
Offline
#10 2009-01-02 17:53:40
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Help Needed: Article Display List
quemultimedia wrote:
<!-- Start .featured_posts -->
<div class="clearfloat">
<h3 class="cat_title"><txp:category1 link="1" title="1" /> » </h3>
<div class="title"><txp:permlink><txp:title /></txp:permlink></div>
<div class="meta">[<txp:posted format="%b %d, %Y" /> | <txp:if_comments> | <txp:comments_invite showcount="0" /> | <txp:comments_count /> Comments
</txp:if_comments>]</div>
<div class="spoiler">
<txp:permlink><txp:article_image thumbnail="1" class="article-image" /></txp:permlink>
<txp:if_excerpt>
<txp:excerpt />
<p class="read-more">
<a href="<txp:permlink />#body"
title="<txp:title />">» Read more</a>
</p>
<txp:else />
<txp:body />
</txp:if_excerpt>
</div>
</div>
<!-- end .featured_posts -->
No <code>
tags needed (won’t work anyway), and just a space (no line break) between bc..
and the start of your code. Sorry for repeating myself, but larger code blocks are pretty unreadable without proper formatting… :) (You can hit ‘Quote’ to see what I did.)
Offline
#11 2009-01-02 18:01:46
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Help Needed: Article Display List
quemultimedia wrote:
- Article Image isn’t showing
Can be one of a couple of things: Is your images folder (in Advanced preferences) set correctly? In the article image field you only have to enter the article ID (no path, no extension). Does the image have a thumbnail?
- Excerpt text has lost all prior formatting [the above HTML chunk is part of the HTML page that I’m trying to ‘port’ to TXP].
You don’t have to copy the <p>
and <br />
tags. Textile converts line breaks to <br />
s and double line breaks to paragraphs.
The Txp tags in your code look fine, no problem there!
Last edited by els (2009-01-02 18:03:36)
Offline
#12 2009-02-07 10:05:24
- Julietta
- New Member
- Registered: 2009-02-07
- Posts: 2
Re: Help Needed: Article Display List
had the same problem, thx all of you guys :)
Last edited by Julietta (2009-02-07 10:05:35)
real girls love Textpattern!
Offline