Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-19 03:51:36

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

"Override form" to work also on article list context

I noticed today that the “Override form” setting only works when the article is rendered in its individual article context.

I would like to know if it could be possible to extend this feature so it also works when articles are being rendered on an article list. In other words, that the overriding form could be used to render the article on both contexts.

I know that this kind of trick (that is, to switch the layout for a particular article) could be triggered by using many of the already existing article conditionals, like: if_article_section, if_article_category, if_custom_field, etc.

But, imho, all have their “shortcomings”, and at the same time the “Override form” setting seems to be the semantically “correct” way of changing the way an article is rendered.

————————-

A possible scenario which will make this extended feature something useful could be this:
an “streaming” of different types of articles: posts, thumbposts, links (managed as txp articles), quotes.
Each kind has its layout (different html and different set of txp article tags).

Some possible solutions with current Txp features

  • Using if_article_section (and assigning each kind of article to a particular seection) is very limiting, because the stream would have to be located on the “default” section (and sections will have to be configured to appear “in front page”). If you want to publish this stream to a section (like /blog/), it gets trickier, I think.
  • Using if_article_category is better than the previous one. Each article is assigned to a category that will determine which layout is used. But then, you waste one of the two possible category slots just for categorize the kind of content, not the content itself.
  • Using if_custom_field is probably the nicest current approach, as it makes it really easy to add a bunch of conditionals to your form and get different layouts for each kind of content. I would also bet that using jmd_admin_js you can convert a custom field (text input) into a dropdown (select field) and make it even easier and less prone to errors. But now we are wasting a custom field on this, when the “Override form” setting could have similar functionality.

————————-

So, is it any chance to take this feature into consideration? There may be some backward compatibility concerns, but probably they could be addressed by a setting, or a new attribute.

Thanks!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2009-02-19 09:45:29

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

Re: "Override form" to work also on article list context

No, it should work on a list too.

Offline

#3 2009-02-19 13:31:03

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

Re: "Override form" to work also on article list context

Ok, I will be doing some more testing then and report back.
Thanks Mary!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2009-02-19 16:37:15

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

Re: "Override form" to work also on article list context

As expected, my fault:

allowoverride attribute’s default value is "1" for txp:article and "0" for txp:article_custom.

Guess which one I was using for generating my list? Yes, txp:article_custom.

Last edited by maniqui (2009-02-19 16:37:28)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB