Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2016-03-13 22:37:20
- pexman
- Member
- Registered: 2016-02-27
- Posts: 61
from excerpt to article normally
I want to have a parent-section which holds the excerpts of all children-sections. If you choose the linked title in the short excerpt it should connect the user to the child-section with the main-text of this article.
My problem is, that I get out the main-text-article on the parent-section and not the excerpt of the article. I tried a lot, but at least I got the excerpt but the title was linked with the article-excerpt and not the main-text.
<!-- left (main) column -->
<div role="main">
<!-- is this result result page? also omits the pagination links below (uses pagination format within search_results.article.txp instead) -->
<txp:if_search>
<h1><txp:text item="search_results" /></h1>
<txp:output_form form="search_results"/>
<txp:else />
<!-- else is this an article category list? -->
<txp:if_category>
<h1><txp:text item="category" /> <txp:category title="1" /></h1>
<txp:article form="article_listing" limit="5" />
<txp:else />
<!-- else is this an article author list? -->
<txp:if_author>
<h1><txp:text item="author" /> <txp:author /></h1>
<txp:article form="article_listing" limit="5" />
<txp:else />
<!-- else display articles normally -->
<txp:article limit="5" /> <!-- links by default to form: 'default.article.txp' unless you specify a different form -->
</txp:if_author>
</txp:if_category>
article_listing form shows, if there is an excerpt, display that otherwise show the main-text.
<txp:if_first_article><ul id="article-list"></txp:if_first_article>
<li role="article" itemscope itemtype="http://schema.org/Article">
<h4 itemprop="name"><a href="<txp:permlink id="{id}"/>" itemprop="url"><txp:title /></a></h4>
<!-- if the article has an excerpt, display that -->
<txp:if_excerpt>
<div itemprop="description">
<txp:excerpt />
</div>
</txp:if_excerpt>
<p class="footnote"><txp:text item="posted" /> <time datetime="<txp:posted format='iso8601' />" itemprop="datePublished"><txp:posted /></time>, <txp:text item="author" /> <span itemprop="author"><txp:author link="1" this_section="1" /></span></p>
</li>
<txp:if_last_article></ul></txp:if_last_article>
I know, there must be an easy solution, but I can`t find.
Offline
Re: from excerpt to article normally
Your setup looks very similar to the default theme code. That basically does this for a normal section landing page:
- Is this a search results article-list page? : No
- else: Is this a category article-list page? : No
- else: Is this an author article-list page? : No
- else: Display with txp:article. txp:article detects internally the current context, i.e. will use the
article_listing
form by default on an article list page (your case) ordefault
when on an individual article page.
So far so good. In your article_listing
form, it looks like you changed the permlink tag, and that is why the link is no longer working (this should be how it originally was). Try taking out the id="{id}"
attribute (that’s the wrong notation btw):
<h4 itemprop="name"><a href="<txp:permlink />" itemprop="url"><txp:title /></a></h4>
txp:article
will use the correct link for the respective article it is displaying so you don’t need to explicitly tell it which article to use. When you click on the link, it takes you to the address of the individual article. The page template then goes through the same series of if checks above but in the last step txp:article
detects that the url-address is of an individual article and displays it using the article form called default
.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2016-03-14 09:11:18
- pexman
- Member
- Registered: 2016-02-27
- Posts: 61
Re: from excerpt to article normally
Thank you once more. But it doesn`t solved the problem. The solution is to give the formlist-attribut to te txp:artikle-tag:
<!-- else display articles normally -->
<txp:article limit="5" listform="article_listing"/>
<!-- links by default to form: 'default.article.txp' unless you specify a different form -->
May be it is the orginal textpatternversion and I delete it in my sunday mess codingsession, but in this case I found it again.
Offline
Pages: 1