Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
sticky
OK… Apologies for this is a basic question that I should know the answer to:)
Does the article tag support a comma delimited list for status?
ie can i have something like <txp:article status="live,sticky" />
?
If not is there a plugin which can do that?
Last edited by colak (2009-04-15 09:20:22)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: sticky
colak wrote:
Does the article tag support a comma delimited list for status?
No, 4.0.8 does not support comma seperated list of statuses. (Minus while you run a seach query, it overrides your status definitions to status 4 and 5. So you basically can have two statuses but only when searching content or viewing an individual article as same happens then too).
colak wrote:
If not is there a plugin which can do that?
You could try to do that with two article
tags and offset.
Offline
Re: sticky
Thanks Jukka, It makes sense although It would be nice if the comma list was an option:)
Maybe the textbook should be more clear on that as the way it lists the attribute implies (to me anyway) that commas are permitted.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: sticky
Yes, this is a pet peeve of mine.
Using two article tags always puts live or sticky up front (.. at the end, … on the front page) and there is no real way to interleave sticky and live articles in a single list at all. I still think a comma-separated option should be available, particularly as it does not break any existing functionality.
Devs, please reconsider. There are so many use scenarios.
TXP Builders – finely-crafted code, design and txp
Offline
#5 2009-04-15 12:13:43
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
I agree there should be a comma-separated option, anyway if you need it now you can try smd_query
Offline
Re: sticky
redbot, thanks:)
what would the query be though:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#7 2009-04-15 13:10:29
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
Try this (not tested):
<txp:smd_query column="*"
table="textpattern"
where="Status='4' OR Status='5'"
form="my_form" wraptag="ul" break="li" />
and your form could be something like:
<h3><a href="<txp:permlink id="{ID}"/>" > {Title}</a></h3>
{Excerpt}
Of course you should change it to suit your needs. Hope it helps.
Offline
Re: sticky
Hi redbot, many thanks for your help, and please excuse my ignorance on this. Does the first snippet replace the <txp:article />
tag?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#9 2009-04-15 15:40:18
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
Does the first snippet replace the <txp:article /> tag
Yes.
It means go to the table named “textpattern”, select all fields (*) for each row in which status is “live” (4) or sticky (5). Each row represents an article.
I think you’ll probably want to refine the query like this, for example:
<txp:smd_query column="*"
table="textpattern"
where="(Status='4' OR Status='5') AND section='my_section' AND category='my_category'"
form="my_form" wraptag="ul" break="li" />
In your article form {ID} and {Title} and {excerpt} represent just some of the previoulsy fetched values, so you can use also {Section}, {Category1}{Image},{Body} and so on.
I suggest you have a look at your tables with phpmyadmin so you can see the exact column names.
The plugin help is also quite exhaustive.
Last edited by redbot (2009-04-15 15:45:02)
Offline
Re: sticky
colak
… and if you’re going with redbot’s idea you may want to automate some of the fields so you can use the tag in a few sections:
<txp:smd_query column="*"
table="textpattern"
where="Status IN (4, 5) AND Section='?section' (AND Category1 IN ('?category') OR Category2 IN('?category') ) AND Posted < now()"
form="my_form" wraptag="ul" break="li" />
That will poke in the values from the current section and category (if used) and also limit the results to articles that are not published in the future. There are probably a few more checks to make but redbot’s approach should certainly get you going.
EDIT: except I’m not sure if the ‘category IN…’ thing will work because if you don’t supply a ?c=
parmeter in the URL it would make the query read: Category1 in('') OR Category2 IN('')
which would only return articles that had no category assigned. Hmmmmm. Might need some more thought on this one.
Last edited by Bloke (2009-04-15 16:05:54)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: sticky
redbot, Stef… Many thanks… Will give it a go and post back on this thread.
I knew that the smd_query would come handy one day:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#12 2009-04-15 16:19:12
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
Bloke wrote:
… I’m not sure if the ‘category IN…’ thing will work because if you don’t supply a
?c=
parmeter in the URL it would make the query read:Category1 in('') OR Category2 IN('')
which would only return articles that had no category assigned. Hmmmmm. Might need some more thought on this one.
Maybe this will work?
<txp:smd_query column="*"
table="textpattern"
where="Status IN (4, 5) AND Section='?section' (AND Category1 IN ('?category') OR Category2 IN('?category') ) AND Posted < now() AND Category1 NOT IN('') AND Category2 NOT IN('') "
form="my_form" wraptag="ul" break="li" />
I’m really not an sql expert so I hope I’m not totally wrong :P
Last edited by redbot (2009-04-15 16:21:56)
Offline