Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-05-31 14:03:38

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Custom article always shows the excerpt

I want to show the excerpt of this article with a read more link to the full page page

<txp:article_custom form="newsflash" section="newsflash" />

My form has a simple test: if it’s a list show the excerpt, otherwise show the body

<txp:if_article_list>
  <h3><txp:title /></h3>
  <txp:excerpt />
  <p><txp:permlink>Read more </txp:permlink></p>
<txp:else />
  <txp:body />
</txp:if_article_list>

The excerpt shows up fine… but also shows up at the top of full article too

I’m sure it’s a simple error, but I can’t seems to get the either or I’m after

Many thanks–and sorry if it’s blindingly obvious

Offline

#2 2020-05-31 14:18:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,270
Website GitHub

Re: Custom article always shows the excerpt

Possibly a subtle issue at play here. It depends where your <txp:article_custom> tag is called from.

If it’s in the page template (or an article) within the newsflash section then it should work fine, and we need to delve deeper to understand why it’s not behaving.

If, however, you’re calling it from an article in a different section, then when you click the permlink, Txp will direct you to the section in which the article resides, which may have a different page template and will thus likely use a different form to render the content – not your newsflash form.

What I do in these situations is output something to the page in the form I’m expecting to run – e.g. HELLO (or <!-- HELLO --> if you’re developing on a live site). Click the article then see what is displayed (or view source if hidden). If HELLO isn’t there, you’re rendering your content with a different form that may well have the <txp:excerpt /> and <txp:body /> tags together.

Does that help?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2020-05-31 16:28:10

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Custom article always shows the excerpt

Thank you Stef,

I’ll give it a whirl… and report back:

That’s exactly what’s happened! It’s using the the form ‘default’ from the native section of Newsflash. Thank you

Last edited by gavnosis (2020-05-31 16:36:23)

Offline

#4 2020-05-31 20:17:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,270
Website GitHub

Re: Custom article always shows the excerpt

Ace. Glad you got it sorted. I’ve stepped on that not the form you thought it was using rake a few times.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB