Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-10-03 10:33:31
- orange900
- New Member
- Registered: 2009-10-03
- Posts: 3
Multiple articles on single page
I would like to display one or two perhaps even three articles on a single page, below is a simple example of what i’m trying to achieve.
<div id=“main”>article 1</div>
<div id=“sub”>
<div id=“sub_header1”>article 2</div>
<div id=“sub_header2”>article 3</div>
</div>
Thanks for your help
Offline
Re: Multiple articles on single page
What kind of page: front page, section front page, other? (give an example URL if those terms don’t click)
Where should the articles come from and how should they be sorted?
Code is topiary
Offline
#3 2009-10-03 12:04:59
- orange900
- New Member
- Registered: 2009-10-03
- Posts: 3
Re: Multiple articles on single page
Thanks for replying. My apologies if I wasn’t clear in my first post, as you can probably tell i’m a bit new to the txp game, but what i should have said is you go to write an article, down in the far bottom right there is a dropdown for the user to attach the article to a certain page. Now i understand that, but im struggling to grasp how one would display two articles on the same page in different areas of the page like in the html code i previously posted as an example. I guessing forms maybe involved somehow but for the life of me am unable to figure it out.
Ps, if its any help i have a created a section called ‘Profile’ and a page also called ‘Profile’.
Once again thanks for your help.
Last edited by orange900 (2009-10-03 12:09:27)
Offline
Re: Multiple articles on single page
orange900 wrote:
you go to write an article, down in the far bottom right there is a dropdown for the user to attach the article to a certain page.
The section dropdown ?
I gather what you are asking for is to display multiple articles on the Profile front page, i.e. the page with the URL /?s=profile
(messy URL mode) or /profile/
(default URL mode). The key is the context-sensitive behavior of the <txp:article />
tag: on a section front page it will display a list of all articles belonging to that section. The same tag will show just a single article on that article’s individual page (i.e., a URL such as /?id=123
in messy URL mode or /profile/123/this-article
in default URL mode).
Am I on the right track?
Code is topiary
Offline
#5 2009-10-03 14:10:58
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Multiple articles on single page
orange900 wrote:
<div id="main">article 1</div>
<div id="sub">
<div id="sub_header1">article 2</div>
<div id="sub_header2">article 3</div>
</div>
You’re probably looking for something like this (on your ‘profile’ page):
<txp:if_article_list>
<div id="main">
<txp:article limit="1" form="form-for-first-article" />
</div>
<div id="sub">
<txp:article limit="2" offset="1" form="form-for-next-articles" />
</div>
<txp:else />
<txp:article form="form-for-single-article" />
</txp:if_article_list>
Form ‘form-for-next-articles’ could look like this:
<txp:if_first_article>
<div id="sub_header1">
<txp:else />
<div id="sub_header2">
</txp:if_first_article>
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:excerpt />
</div>
Offline
#6 2009-10-03 16:32:33
- orange900
- New Member
- Registered: 2009-10-03
- Posts: 3
Re: Multiple articles on single page
Thank you both very much for you help, Els that was exactly what i was after. Thank you!
Offline
Pages: 1