Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2015-01-28 22:26:29
- Freeant
- Member
- Registered: 2012-04-16
- Posts: 36
Аnother page for the full article
Is it possible to assign to the full article another page?
For Example.
Short article – default
Full Article – default2
Last edited by Freeant (2015-01-28 22:31:01)
Offline
Re: Аnother page for the full article
I’m not sure I quite understand the logic behind this request. A Page is assigned to a Section. Articles appear inside Sections, and thus get a Page by inference. So one article can only have one Page, since any one Article can only appear in one Section.
Unless your short article is a completely different article (assigned to a different Section), the answer is no (although see later for a possible workaround). But, if by “full article” you mean the full body text vs (for example) the excerpt or a short extract of the body text, then you can use Textpattern Forms to switch between how you want to render the article content inside its Page template based on the URL (its “context”: either a list of articles or an individual article).
Normally, a Page template is a skeleton structure for all articles in a given Section: Doctype, <html>
, <head>
, <body>
tags and any <div>
containers, with a little logic thrown in to check if you are on a landing (list) page or an individual article, plus an <article>
tag or two Then your nominated Forms take over to process and render the article content accordingly.
If you have a specific use case where you want a completely different look for an individual article Page compared with a List page, well, it can be done, but it’s more tricky. I’m in the process of doing something like that where articles in the same Section have one of two radically different visual styles depending on a custom field setting. You can’t get away from the fact that there’s only one physical Page template for all articles in a Section, but you can use Forms and conditional tags to customise things to make it appear they’re different.
So, please explain what it is you want to achieve exactly and we’ll go from there.
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
Online
Re: Аnother page for the full article
Hi Freeant
would this be of help?
<txp:if_article_list>
<txp:article>
<txp:excerpt />
<txp:permlink>Read more...</txp:permlink>
<txp:else /> <txp:hide>you are in an individual article</txp:hide>
</txp:body />
</txp:article>
</txp:if_article_list>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#4 2015-01-29 12:05:01
- Freeant
- Member
- Registered: 2012-04-16
- Posts: 36
Re: Аnother page for the full article
In general there is different “head” in the short and full articles.
1. In “head” of the short article there is a link to external jOuery script and in the full article there is another jQuery script instead of it.
2. Besides in “head” it is used another css file.
? thx
————————————-
P.S
my default form
<txp:if_article_list>
<div class="item">
<p class="tema">
<txp:permlink>
<txp:title />
</txp:permlink>
</p>
<div class="txt">
<txp:rss_auto_excerpt
paragraphs="2"
body="body"
overrideexcerpt="1"
showlinkwithexcerpt="0"
striptags="0" />
</div>
</div><!--item-->
<txp:else />
<div class="item">
<p class="tema">
<txp:permlink>
<txp:title />
</txp:permlink>
</p>
<div class="txt">
<txp:body /> <txp:excerpt />
</div>
</div><!--item-->
</txp:if_article_list>
{ Moderator’s annotation: Run code through formatter. – Uli }
Last edited by uli (2015-01-29 12:36:39)
Offline
#5 2015-01-29 12:38:50
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,304
Re: Аnother page for the full article
Freeant wrote #287891:
1. In “head” of the short article there is a link to external jOuery script and in the full article there is another jQuery script instead of it.
2. Besides in “head” it is used another css file.
You can use if<->else filtering tag(s) several times on the same page, eg. once in the head region and then a second time like you do above, if that’s your concern.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Аnother page for the full article
Freeant wrote #287891:
In general there is different “head” in the short and full articles.
Thanks for the clarification. That’s what I thought you meant. I presume the two types of article are completely separate entities (different article IDs), but assigned to the same Section then? Because if they were in different Sections then the problem goes away, right?
This is what I was alluding to as a way of turning the conventional page flow on its head and using the actual article to determine layout.
For background, and as I mentioned in my previous post, the structure of Page templates usually prohibits you from taking article-centric action in things like the <head>
because Txp doesn’t know the content of your article until later (usually inside the <body>
). Therefore you need to structure your Page in such a way that the entire page is wrapped in an article tag.
This does pose a few problems, especially on list pages, because <head>
content, for example, would get repeated for each article. Here’s a general Page template workflow to get round that:
<html>
<txp:article limit="999" sort="Posted asc">
<txp:if_first_article>
<txp:output_form form="head" />
<body>
<txp:output_form form="page_head" />
<div class="wrapper">
<div class="container">
<div role="main">
</txp:if_first_article>
<txp:output_form form="content" />
<txp:if_last_article>
</div><!-- /main -->
<div role="complementary">
<txp:search_input />
</div><!-- /complementary -->
</div><!-- /.container -->
</div><!-- /.wrapper -->
<txp:output_form form="page_foot" />
</body>
</txp:if_last_article>
</txp:article>
</html>
Using this structure, your head
Form can load a different CSS file based on some article property.
Note that your content
Form may also have to do some if_first/if_last article detection to prevent displaying other ‘static’ elements more than once, but in general this approach will allow you to take template actions depending on some content in your article.
Hope that helps.
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
Online
#7 2015-01-29 13:49:12
- Freeant
- Member
- Registered: 2012-04-16
- Posts: 36
Re: Аnother page for the full article
I’ll try that.. Thank you very much.
Last edited by Freeant (2015-01-29 13:50:16)
Offline
Re: Аnother page for the full article
Bloke wrote #287899:
This does pose a few problems, especially on list pages, because
<head>
content, for example, would get repeated for each article. Here’s a general Page template workflow to get round that:
There is a second way around that I have used – use a different section for list pages. It comes in handy especially when you are using a date-based scheme for individual articles.
Offline
#9 2015-01-29 20:39:25
- Freeant
- Member
- Registered: 2012-04-16
- Posts: 36
Re: Аnother page for the full article
michaelkpate
There is a second way around that I have used – use a different section for list pages. It comes in handy especially when you are using a date-based scheme for individual articles.
Is not entirely clear, you can detail…)…
Last edited by Freeant (2015-01-29 20:40:13)
Offline
#10 2015-02-02 18:05:00
- alivato
- Member
- Registered: 2011-03-31
- Posts: 151
Re: Аnother page for the full article
Plugin soo_if_frontpage
<txp:soo_if_frontpage pg="1">
... Home page ONLY
<txp:else />
... any other page
</txp:soo_if_frontpage>
Offline
Pages: 1