Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-07-29 08:03:41
- bnetz
- Member
- Registered: 2009-07-17
- Posts: 11
frontpage: only show list of articles
hi,
on my starting page (“front page”) i want to show a list of all articles (just the article-titles, linked to the articles). to choose “no” in the section-options under “show on front page” seems to me not very elegant. doesn’t that work with a simple tag?
thanks in advance!
Last edited by bnetz (2009-07-29 08:07:35)
Offline
Re: frontpage: only show list of articles
The “Show on front page” option does not automatically cause articles to appear there — it controls whether or not articles will be included in a list produced by a <txp:article />
tag. Set every section to show on front page.
To get titles only, use <txp:article form=“article_listing” /> if you still have the default article_listing
form included in a new installation, or make your own article form with the elements you want.
Alternately, use txp:article_custom />
, which will show articles from all sections regardless of the “Show on front page” settings. You lose pagination, however.
Last edited by jsoo (2009-07-29 11:16:05)
Code is topiary
Offline
#3 2009-07-29 11:17:29
- bnetz
- Member
- Registered: 2009-07-17
- Posts: 11
Re: frontpage: only show list of articles
thanks for your answer! but i am still confused, because the article-listing-tag is already used. i show you the code, it’s from the default-installation (sorry, i am pretty new to textpattern):
<div id="content">
<txp:if_category>
<h2><txp:category title="1" /></h2>
<div class="hfeed">
<txp:article form="article_listing" limit="5" />
</div>
<txp:else />
<txp:if_search>
<h2><txp:text item="search_results" />: <txp:page_url type="q" /></h2>
<div class="divider"><img src="<txp:site_url />images/1.gif" width="400" height="1" alt="---" title="" /></div>
</txp:if_search>
<div class="hfeed">
<txp:article limit="10" sort="LastMod desc" />
</div>
</txp:if_category>
<txp:if_individual_article>
<div class="divider"><img src="<txp:site_url />_images/1.gif" width="400" height="1" alt="---" title="" /></div>
<p><txp:link_to_prev>« <txp:prev_title /></txp:link_to_prev>
<txp:link_to_next><txp:next_title /> »</txp:link_to_next></p>
<txp:else />
<p><txp:older>« <txp:text item="older" /></txp:older>
<txp:newer><txp:text item="newer" /> »</txp:newer></p>
</txp:if_individual_article>
</div>
so i am really confused about where to insert the <txp:article form=“article_listing” />
-tag … perhaps you could help me out?
thanks …
Offline
Re: frontpage: only show list of articles
Right, there are two article
tags on the default Page of a new installation (should I say the default default Page? sheesh…)
<div id="content">
<txp:if_category>
<h2><txp:category title="1" /></h2>
<div class="hfeed">
<txp:article form="article_listing" limit="5" />
That one is for category list context, i.e. a URL such as <http://mysite.com/category/balloons
or <http://mysite.com/?c=balloons
. This shows a list of articles from that category only.
<txp:else />
<txp:if_search>
<h2><txp:text item="search_results" />: <txp:page_url type="q" /></h2>
<div class="divider"><img src="<txp:site_url />images/1.gif" width="400" height="1" alt="---" title="" /></div>
</txp:if_search>
<div class="hfeed">
<txp:article limit="10" sort="LastMod desc" />
That one is for any other context: search results, front page, section front page, individual article. If you are using the default Page for any sections other than the default section, you will need to deal with individual articles as well as lists. Use the if_individual_article
conditional. You can use it on the page and call separate forms, or you can use a single form and put the conditional there. As a learning exercise the simplest thing for now might be to replace that last article
tag with this:
<txp:if_individual_article>
<txp:article />
<txp:else />
<txp:article form="article_listing" />
</txp:if_individual_article>
Code is topiary
Offline
#5 2009-07-29 12:26:25
- bnetz
- Member
- Registered: 2009-07-17
- Posts: 11
Re: frontpage: only show list of articles
hey, thanks you for the informative explanations and your solution!
it works, with some constraint (which right now doesn’t worry me):
if i replace the complete content with the snippet you suggested, everything works fine. if i keep the stuff above, on the start- and overview-pages i still have the complete articles. the code i have to trash is this:
<txp:if_category>
<h2><txp:category title="1" /></h2>
<div class="hfeed">
<txp:article form="article_listing" limit="5" />
</div>
<txp:else />
<txp:if_search>
<h2><txp:text item="search_results" />: <txp:page_url type="q" /></h2>
<div class="divider"><img src="<txp:site_url />images/1.gif" width="400" height="1" alt="---" title="" /></div>
</txp:if_search>
<div class="hfeed">
<txp:article limit="10" sort="LastMod desc" />
</div>
</txp:if_category>
so as i told, it works for me, wanted to post this just for information.
thanks again!
Offline
Pages: 1