Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-26 13:40:24

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

mulitple list forms

HI,

Ive hit a small problem I need to resolve fast. Im using textpattern article lists to populate an slideshow. this is for a plasma screen in a company reception, so it needs to just ouput a list of all the articles on one page.

Ive got this working fine but the problem is each of the slides has its own design. Textpattern allows setting of ONE listform. This means ALL the slides are useing the SAME design. I need to be able to list each item in the article with its own form. You can override forms when creating an article but this effects the article display, not how it displays in the article list.

The designs are driven by classes in the list but its generating like this at the moment becuase its using one listtform for whole list:

<ul>
<li><div class=“design-one”> content </div> </li>
<li><div class=“design-one”> content </div> </li>
<li><div class=“design-one”> content </div> </li>
</ul>

I need the article list to generate like this:

<ul>
<li><div class=“design-one”> content </div> </li>
<li><div class=“design-two”> content </div> </li>
<li><div class=“design-three”> content </div> </li>
</ul>

Does anyone know how to achieve this?

Thanks.

Last edited by CodeWalker (2010-08-26 13:48:33)

Offline

#2 2010-08-26 14:26:35

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: mulitple list forms

The most simple solution which comes to my mind is to use a custom field to define the proper class for an article.

(Edited: Deleted wrong solution for better reading)

You can use class="<txp:custom_field name="class" default="class1">" in your listform.

<txp:article break="li" listform="slideshow" wraptag="ul" />

Listform“slideshow”:

<div class="<txp:custom_field name="class" default="class1">">
<!-- content -->
</div>

(Sleepy: Added a missing double quote for class and the closing angle bracket)

Last edited by merz1 (2010-08-26 14:56:32)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#3 2010-08-26 14:31:56

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: mulitple list forms

Hi. Thanks alot for your answer. However, I considered doing this but its my understanding that custom field values cant be read back in an article list. They only work on an individual article page.

Am I wrong?

Offline

#4 2010-08-26 14:36:21

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: mulitple list forms

Edited my original answer. See above.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#5 2010-08-26 14:39:30

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: mulitple list forms

Hi CodeWalker,
yes, you are :)

You can use any article tag inside a txp:article or txp:article_custom, it doesn’t matter if you are in individual article or in article list context.
The only difference is when you want to throw article tags (like txp:title or txp:custom_field) directly somewhere on the page template, without wrapping them on an txp:article or txp:article_custom. In tha case, the non-wrapped article tags will be read and rendered on individual article context (which is, after all, an article), but not on article list context.

Hope it makes sense.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2010-08-26 14:42:35

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: mulitple list forms

Markus, I think you were on the right path initially, even when you posted just some quick, non-functional code.
You said:

<ul>
<li><div class="<txp:custom_field name="class" default="class1">" content </div> </li>
</ul>

Which “expanded” to some real TXP code, could be done like this:

<txp:article wraptag="ul">
<li><div class="<txp:custom_field name="class" default="class1">" content </div> </li>
</txp:article>

And that should be enough for CodeWalker to achieve what he is after of.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2010-08-26 14:49:39

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: mulitple list forms

Well, I just used the given example code to show how it works.
I updated my first post a 2nd time to the full monty now.
I hope this is functional enough now :)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#8 2010-08-26 14:58:07

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: mulitple list forms

Please review :)

You can use class="<txp:custom_field name="class" default="class1">" in your listform.

<txp:article break="li" listform="slideshow" wraptag="ul" />

Listform“slideshow”:

<div class="<txp:custom_field name="class" default="class1">">
<!-- content -->
</div>

Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#9 2010-08-26 15:05:04

CodeWalker
Member
From: Hampshire, UK
Registered: 2010-01-08
Posts: 110
Website

Re: mulitple list forms

Thanks Guys, Ill try it out. I came up with my own solution and that was to use category to set the design. I simply put the category tag in the div class. That way, the design can be chosen from a drop down list. I think your way might be a little more elegant tho.

Thanks both.

Offline

#10 2010-08-26 15:59:57

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: mulitple list forms

Well, you can use any field. The category field is good because of the mentioned drop down list. On the other hand it’s semantically bad because you use a content field for design purposes. As long as the chosen content category fits to your design choice I am totally fine with that :)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB