Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-02 14:14:57

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

<txp:if_section> and articles layout

my homepage is in 2 different languages. at the moment i just want to duplicate estonian content into english version pages. so i made like this:

<txp:if_section name="news">
<txp:article_custom section="uudised" limit="99" />
</txp:if_section>

<txp:if_section name="articles">
<txp:article_custom section="artiklid" limit="99" />
</txp:if_section>

and so on...

it displays right sections but it doesnt display articles layout like i do in estonian pages.
for example: in estonian section “uudised” i use:

<txp:article limit="1" />
<txp:if_article_list>
<ul>
<txp:article form="article_b" offset="1" limit="90" />
</ul>
</txp:if_article_list>

this code displays last (newest) article with excerpt and below it list of older articles (only titles) here

but in english ver. it displays all articles with excerpts, no list of article titles.

do i need write something more between <txp:if_section> tags or it’s just not possible because of <txp:article_custom /> tag?

Offline

#2 2008-01-02 20:32:07

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:if_section> and articles layout

Easy and simple. If you don’t style txp:article_custom, it will only show a regular list. So lets do something about it:

<txp:if_section name="news">
	<txp:article_custom section="uudised" limit="1" />
	<ul>
		<txp:article_custom section="uudised" limit="90" offset="1" form="article_b" />
	</ul>
</txp:if_section>

<txp:if_section name="articles">
	<txp:article_custom section="artiklid" limit="1" />
	<ul>
		<txp:article_custom section="artiklid" limit="90" offset="1" form="article_b" /> <!-- Added here form and offset attribute -->
	</ul>
</txp:if_section>

Cheers!

Last edited by Gocom (2008-01-02 20:32:30)

Offline

#3 2008-01-03 10:55:38

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: <txp:if_section> and articles layout

Gocom wrote:

Easy and simple.

in your hands all turns to gold ;) thanks again!

one more little question. Is this code below – i use in page template – correct and optimal in your opinion or you would make it little bit differently?

<txp:article limit="1" />
<txp:if_article_list>
<ul>
<txp:article form="article_b" offset="1" limit="90" />
</ul>
</txp:if_article_list>

Offline

#4 2008-01-03 11:00:45

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:if_section> and articles layout

Nothing wrong with that code ;) It’s good and possibly the best way to offer one different kind article than others. Second way is by using txp:if_first_article inside article forms.

Cheers!

Offline

#5 2008-01-03 13:12:56

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: <txp:if_section> and articles layout

one more thing :)
in estonian default page i want to make something like this:

<txp:if_section name="">
<txp:article limit="1" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="1" limit="90" /></ul>
</txp:if_article_list>
</txp:if_section>

<txp:if_section name="artiklid">
<txp:article limit="3" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="3" limit="90" /></ul>
</txp:if_article_list>
</txp:if_section>

else

<txp:article limit="1" />

but i don’t know how exactly the right code should look like?

Offline

#6 2008-01-03 16:02:52

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: <txp:if_section> and articles layout

For “else” you need to use <txp:else /> however it is sitting outside any “if” statement so you might need to use something like:-

<txp:if_section name=",artiklid">
<txp:else />
<txp:article limit="1" />
</txp:if_section>

Last edited by thebombsite (2008-01-03 16:15:40)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2008-01-04 10:53:46

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: <txp:if_section> and articles layout

thebombsite wrote:

bc. <txp:if_section name=”,artiklid”>
<txp:else />
<txp:article limit=“1” />
</txp:if_section>

but, where i write this :

<txp:if_article_list>
<ul><txp:article form="article_b" offset="1" limit="90" /></ul>
</txp:if_article_list>

didn’t you miss something?

Offline

#8 2008-01-04 11:25:11

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:if_section> and articles layout

Stuart was meaning:

<txp:if_section name="">
<txp:article limit="1" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="1" limit="90" /></ul>
</txp:if_article_list>
</txp:if_section>

<txp:if_section name="artiklid">
<txp:article limit="3" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="3" limit="90" /></ul>
</txp:if_article_list>
</txp:if_section>

<txp:if_section name=",artiklid">
<txp:else />
<txp:article limit="1" />
</txp:if_section>

Cheers!

Offline

#9 2008-01-04 12:04:11

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: <txp:if_section> and articles layout

aa, i see. but, would this:

<txp:if_section name="">
<txp:article limit="1" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="1" limit="90" /></ul>
</txp:if_article_list>
<txp:else />
<txp:article limit="1" />
</txp:if_section>

<txp:if_section name="artiklid">
<txp:article limit="3" />
<txp:if_article_list>
<ul><txp:article form="article_b" offset="3" limit="90" /></ul>
</txp:if_article_list>
<txp:else />
<txp:article limit="1" />
</txp:if_section>

also do the job? is it same?

Offline

#10 2008-01-04 13:08:42

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:if_section> and articles layout

No, because it would output two <txp:article limit="1" /> when not in frontpage nor section named artiklid.

In example in section archive, you would see:

<txp:article limit="1" />
<txp:article limit="1" />

Cheers!

Offline

#11 2008-01-04 14:09:24

Gallex
Member
Registered: 2006-10-08
Posts: 1,308

Re: <txp:if_section> and articles layout

Gocom wrote:

No, because it would output two <txp:article limit="1" /> when not in frontpage nor section named artiklid.

so you say, it’s a best (and only?) solution? ok.

and when i want to add another differently designed section, i just write it name <txp:if_section name=”,artiklid…here….”>
<txp:else />
<txp:article limit=“1” />
</txp:if_section>

?

Offline

#12 2008-01-04 14:52:45

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: <txp:if_section> and articles layout

Gallex wrote:

so you say, it’s a best (and only?) solution? ok.

Everything can be done by millions of ways, and in future the amount just gets bigger ;) But, yeah by this far it’s the best solution.

and when i want to add another differently designed section, i just write it name <txp:if_section name=”,artiklid…here….”>

Exatly.

Cheers!

Last edited by Gocom (2008-01-04 14:53:47)

Offline

Board footer

Powered by FluxBB