Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-14 20:01:01

eivl
Member
Registered: 2009-04-09
Posts: 20

How Do I use Excerpt on my page?

How can i use an excerpt on my page? i have tried to look and have gotten answers, but none have so far worked

—————————-
Here is my presentation file:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<head> <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /> <title><txp:page_title /></title> <link rel=“home” href=”<txp:site_url />” /> <txp:feed_link flavor=“atom” format=“link” label=“Atom” /> <txp:feed_link flavor=“rss” format=“link” label=“RSS” /> <txp:css format=“link” /> <txp:rsd />

<script type=“text/javascript” src=”<txp:site_url/>textpattern/jquery.js”></script>
<script type=“text/javascript” src=”<txp:site_url/>shadowbox/build/adapter/shadowbox-jquery.js”></script>
<script type=“text/javascript” src=”<txp:site_url/>shadowbox/shadowbox-2.0.js”></script>
<script type=“text/javascript”> Shadowbox.loadSkin(‘classic’, ‘<txp:site_url/>shadowbox/src/skin’); Shadowbox.loadLanguage(‘en’, ‘<txp:site_url/>shadowbox/build/lang’); Shadowbox.loadPlayer([‘img’], ‘<txp:site_url/>shadowbox/build/player’); window.onload = Shadowbox.init;
</script>

</head>
<body>
<div id=“mainwrap”>
<div id=“wrapper”>
<div id=“header”><a href=”/”></a></div>
<div id=“menu”>
<txp:linklist category=“meny” break=” “ sort=“date” />
</div>

<div id=“content”>
<!——————— <p> info</p>——————>
<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=“5” /> </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>&#171; <txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /> &#187;</txp:link_to_next></p>
<txp:else /> <p><txp:older>&#171; <txp:text item=“older” /></txp:older> <txp:newer><txp:text item=“newer” /> &#187;</txp:newer></p>
</txp:if_individual_article>
</div>

<div id=“sidebar”>

</div>
</div>
</div>
</div>
</body>
</html>

————————

Here is my default form:

<txp:if_individual_article>
<h1 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h1>

<txp:else />
<h3 class=“entry-title”><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_individual_article>

<p class=“published”><txp:posted /></p>

<div class=“entry-content”>
<txp:body />

</div>

<address class=“vcard author”>&#8212; <span class=“fn”><txp:author /></span></address>

<p class=“tags”><txp:category1 title=“1” link=“1” /> , <txp:category2 title=“1” link=“1” /></p>

<txp:comments_invite wraptag=“p” />

<div class=“divider”><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” alt=”—-” title=”“ /></div>

Offline

#2 2009-04-14 20:25:05

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: How Do I use Excerpt on my page?

In your default form, replace <txp:body/> with:

<txp:if_article_list>
    <txp:excerpt/>
<txp:else/>
    <txp:body/>
</txp:if_article_list>

Be sure to bookmark the tag reference.

Offline

#3 2009-04-14 21:01:43

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: How Do I use Excerpt on my page?

Thanks for the quick reply, it works like a charm, but how can i make the first part of the article show with a ….read more link?

Offline

#4 2009-04-14 21:05:21

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: How Do I use Excerpt on my page?

Offline

#5 2009-04-14 21:43:28

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: How Do I use Excerpt on my page?

got the link working, thanks jm! =)
have been looking at the tag ref you gave me, great tool to have, but i cant find a way to limit <txp:body/> to only show the first, oh well lets say 10 words.

at the moment i have

[Title]
>>Read more

what i want is

[Title]
The 10 first words of the article, like i described…
>>Read more

Offline

#6 2009-04-14 21:50:21

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: How Do I use Excerpt on my page?

rss_auto_excerpt is what you need. It’s abandoned but still functional.

Offline

#7 2009-04-14 22:20:21

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: How Do I use Excerpt on my page?

Thanks again! only getting “… “ as output, but i will look at it in the morning, getting so late that i realy have to get some sleep..

Hope to continiue this in the mornging jm! =)

Offline

#8 2009-04-15 19:20:13

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: How Do I use Excerpt on my page?

works now, but is it possible to let the first article be shown in full and the rest with excerpt?

Offline

#9 2009-04-15 19:22:15

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: How Do I use Excerpt on my page?

Use if_first_article:

<txp:if_first_article>
    <txp:body/>
<txp:else/>
    <txp:rss_auto_excerpt.../>
</txp:if_first_article>

Offline

#10 2009-04-15 19:31:48

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: How Do I use Excerpt on my page?

Thanks! all that i want is on place!

Offline

Board footer

Powered by FluxBB