Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-28 10:59:09

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

Style the first article different?

I’ve got the last 5 articles on my page.
Now I want to put the first one in a different div in order to style it different.

So what I want is this:

<code>

<div id=“highlight”>Last article</div>
<div id=“older”>The 4 other articles</div>

</code>

Is that possible?

Thanks.

Offline

#2 2006-02-28 11:24:34

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: Style the first article different?

<code>
<div id=“highlight”><txp:article limit=“1” /></div>
<div id=“older”><txp:article limit=“4” offset=“1”/></div>
</code>

Offline

#3 2006-02-28 11:26:23

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: Style the first article different?

You can even use the <code>listform</code> and <code>form</code> attributes of <code>txp:article</code> to use an absolutely different layout.

Offline

#4 2006-02-28 11:38:37

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,393
Website GitHub Mastodon

Re: Style the first article different?

Second possibility: txp:if_first_article.

Online

#5 2006-03-01 08:15:01

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

Re: Style the first article different?

Thanks.
This one works perfectly.

Offline

#6 2006-03-01 18:59:28

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: Style the first article different?

A note about the first option: I suggested the same thing a while back and was reminded that doing so can <a href=“http://forum.textpattern.com/viewtopic.php?id=12728”>doing so can screw up your pagination</a>.

I don’t know if the pagination feature matters to you, but it’s something to keep in mind.

Offline

#7 2006-03-01 19:38:07

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Style the first article different?

The pagination problem shouldn’t be a problem anymore, now that we have the pageby attribute (should be added to the wiki).

Last edited by Mary (2006-03-01 19:38:20)

Offline

#8 2006-03-01 20:58:48

janw
Member
From: Groningen
Registered: 2005-11-18
Posts: 47

Re: Style the first article different?

I already liked the “txp:if_first_article” solution better….

Offline

#9 2006-03-01 22:32:40

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: Style the first article different?

That’s what I figured, janw, but I figured that it couldn’t hurt to clarify. Especially in case people later find this thread through a search and decide to implement the first option.

Last edited by Elenita (2006-03-01 22:33:14)

Offline

#10 2006-03-01 23:16:43

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Style the first article different?

FYI: this is in the FAQ.


Alex

Offline

#11 2006-07-21 08:48:16

satellite360
Member
Registered: 2006-04-24
Posts: 14

Re: Style the first article different?

Just started working with textpattern and having problems with this tag. What is wrong with this?

<code>
<txp:if_first_article> <div id=“headline”> <txp:article /> </div>
<txp:else /> <div id=“recent”> <txp:article limit=“2” /> </div>
</txp:if_first_article>
</code>

It displays 2 articles (the 2 most recent) in the ‘recent’ div and nothing in the ‘headline’ div.

Thanks for any help.

Offline

#12 2006-07-21 09:00:50

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: Style the first article different?

I think that txp:if_first_article is only valid inside an article form. You can use this markup:

<code><div id=“headline”><txp:article limit=“1”/></div>
<div id=“recent”><txp:article limit=“2” offset=“1”/></div></code>

Hope this helps.

Offline

Board footer

Powered by FluxBB