Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: sticky
This discussion always make me sing this just substitute “sticky” for “tricky”
Devs: Please, please, oh please, change the article tag to allow for multiple statuses in the same list. I promise I’ll shutup.
Offline
#14 2009-04-15 18:12:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: sticky
colak wrote:
Maybe the textbook should be more clear on that as the way it lists the attribute implies (to me anyway) that commas are permitted.
If a comma separated list is permitted, Textbook says Value: (comma separated list of) … Did you have an idea of how it could be made more clear when an attribute only accepts a single value? Because most of them do, so to me it makes more sense to only tell you when it doesn’t… ;)
Last edited by els (2009-04-15 18:14:22)
Offline
Re: sticky
Els, you are absolutely right. Maybe it was wishful thinking but when I read
status="status"
Restrict to articles with specified status.
Values: live, sticky
...
A clearer way (to me anyway) would be Value: live or sticky
. Using the singular in Value
implies that we are allowed only one of the two. Also I would avoid using the comma
as it is used as a parameter for certain tags which is where my confusion lied.
Last edited by colak (2009-04-16 08:34:27)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: sticky
redbot wrote:
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" />
It doesn’t work:(
What I did is that I replaced the article tag in the archives page with yours and I am receiving the following error
Tag error: <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" /> -> Textpattern Notice: Form not found: my_form on line 1517
textpattern/lib/txplib_misc.php:1517 trigger_error()
textpattern/lib/txplib_misc.php(570) : eval()'d code:25 fetch_form()
textpattern/publish.php:1090 smd_query()
textpattern/publish.php:1012 processTags()
textpattern/publish.php:496 parse()
index.php:33 textpattern()
Tag error: <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" /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(AND Category1 IN ('category') OR Category2 IN('category') ) AND Posted < now() ' at line 1
select * from textpattern where Status IN (4, 5) AND Section='articles' (AND Category1 IN ('category') OR Category2 IN('category') ) AND Posted < now() AND Category1 NOT IN('') AND Category2 NOT IN('')
textpattern/lib/txplib_db.php:209 getRows() on line 82
textpattern/lib/txplib_db.php:82 trigger_error()
textpattern/lib/txplib_db.php:269 safe_query()
textpattern/lib/txplib_db.php:209 getRows()
textpattern/lib/txplib_misc.php(570) : eval()'d code:67 safe_rows()
textpattern/publish.php:1090 smd_query()
textpattern/publish.php:1012 processTags()
textpattern/publish.php:496 parse()
index.php:33 textpattern()
Tag error: -> Textpattern Notice: Page template archive does not contain a txp:article tag on line 504
textpattern/publish.php:504 trigger_error()
index.php:33 textpattern()
I guess that the error can be summarised to
- form=“my_form” /> -> Textpattern Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version…
- Textpattern Notice: Page template archive does not contain a txp:article tag on line 504* which I guess that it means that txp does not recognise the query as a replacement to the
txp:article
?
>Edit: The mysql version I am on is: 5.0.45-log with PHP 5.1.4
Last edited by colak (2009-04-16 09:46:10)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: sticky
Hmm, this is trickier than I’d hoped. I need an easy way of allowing you to make conditional SQL chunks in the plugin so if a variable doesn’t exist that hunk of SQL is completely omitted. I tried using the defaults
attribute but it wouldn’t play ball. Leave that thought with me.
For now, this bit of tags-in-tags magic should get you going:
<txp:smd_query column="*"
table="textpattern"
where='Status IN (4, 5) AND Section="article" <txp:if_category>AND (Category1 IN ("?c") OR Category2 IN ("?c"))</txp:if_category> AND Posted < now()'
wraptag="ul" break="li">
Put your {replacement} tags here
</txp:smd_query>
Last edited by Bloke (2009-04-16 10:17:48)
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
Hi stef and thanks sooo much for this help.
I am using:
<txp:smd_query column="*"
table="textpattern"
where='Status IN (4, 5) AND Section="article" <txp:if_category>AND (Category1 IN ("?c") OR Category2 IN ("?c"))</txp:if_category> AND Posted < now()'
I am now officially giving up the idea.
The problem is that I am still unable to even see a sticky article when on its individual page.
<h2>{Title}</h2>
{body}
</txp:smd_query>
and it returns this error
Tag error: -> Textpattern Notice: Page template archive does not contain a txp:article tag on line 504
textpattern/publish.php:504 trigger_error()
index.php:33 textpattern()
I can see them all by using <txp:article_custom form="article-body" status="sticky" limit="999" break="li" wraptag="ul" />
wraptag=“ul” break=“li”>@ but this only seems to work on the default page.
I have also tried using wet_if_status in an article form so as to make stickies show in other pages but to no avail.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: sticky
colak wrote:
I am now officially giving up the idea… Page template archive does not contain a txp:article tag
Ah yes, that’s the downside. Drrrty sasser frasser rasser…
In that case I don’t know of a solution (yet) but my next plugin might sort of help… ish. If I ever get rid of the last remaining bug :-(
Last edited by Bloke (2009-04-16 15:33:51)
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
Bloke wrote:
Ah yes, that’s the downside. Drrrty sasser frasser rasser…
In that case I don’t know of a solution (yet) but my next plugin might sort of help… ish. If I ever get rid of the last remaining bug :-(
Your plugins have become indispensable. Looking forward to your next wonder.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: sticky
If I recall correctly, txp throws the no txp:article tag error whenever there is no article or article_custom tag on a page but doesn’t actually affect anything so it is unrelated to smd_query. You can fulfil txp’s need to have the article tag without outputting anything by using <txp:article pgonly="1" />
but it serves no real purpose.
What happens if you strip your where="..."
query down to first principles and leave out the categories for the moment (i.e. just status and section). Another thing to try is to temporarily insert your txp:article tag that works for just live articles, then look at your tag trace for the where statement, then reintroduce the (Status='4' OR Status='5')
or Status IN (4, 5)
back into the equation.
TXP Builders – finely-crafted code, design and txp
Offline
Re: sticky
Do you still worry about txp:article tagnot found
? It’s just a notice to you – when you see your site while developping without articles and scratching the head: “What happend.. Where is content?” You look at the top of the page and see notice- <txp:article /> not found
. And you’re happy – you go to Page, find unclosed if_statement and your site rocks againg :)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: sticky
jakob wrote:
If I recall correctly, txp throws the no txp:article tag error whenever there is no article or article_custom tag on a page but doesn’t actually affect anything so it is unrelated to smd_query. You can fulfil txp’s need to have the article tag without outputting anything by using
<txp:article pgonly="1" />
but it serves no real purpose.
the_ghost wrote:
Do you still worry about
txp:article tagnot found
? It’s just a notice to you – when you see your site while developping without articles and scratching the head: “What happend.. Where is content?” You look at the top of the page and see notice-<txp:article /> not found
. And you’re happy – you go to Page, find unclosed if_statement and your site rocks again :)
In theory the smd
query acts as a replacement to the article
tag
jakob wrote:
What happens if you strip your
where="..."
query down to first principles and leave out the categories for the moment (i.e. just status and section). Another thing to try is to temporarily insert your txp:article tag that works for just live articles, then look at your tag trace for the where statement, then reintroduce the(Status='4' OR Status='5')
orStatus IN (4, 5)
back into the equation.
Hi Jakob, thanks, I have tried your suggestion which again returned no results.
In any case. This is how I am approaching the problem and I think that it produces the results I am looking for.
The problem. I wanted the stickies to include some reviews which would be visible in the front page in an auto rotation manner using a jquery plugin. I also wanted them to appear as articles in the article listings under the “about” category.
I created a category called “reviews”.
I created the menu but excluded that category: <txp:category_list label="Categories" wraptag="ul" break="li" exclude="reviews" />
I then show the listing in the conditional
<txp:if_category" name="about">
<txp:article />
<txp:article_custom category="reviews" limit="999" listform="review" />
<txp:else />
<txp:article />
</txp:if_category>
Not perfect but it works:)
Last edited by colak (2009-04-17 06:35:05)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Online
Re: sticky
The problem. I wanted the stickies to include some reviews which would be visible in the front page in an auto rotation manner using a jquery plugin. I also wanted them to appear as articles in the article listings under the “about” category.
I understand the problem as I’ve had similar situations. In the end you’ve used an alternative “grouping method” of your own to get them on the front page while listing them where they belong too. That’s workable if you have spare categories or if you have only one kind of content like your reviews, but not if you are using your categories for other things elsewhere or want content from different places to show on the front page. Then you need to use an extra “show-on-front-page” custom field, but its a kind of sledgehammer to crack a nut approach.
I still find the current interpretation of “sticky” as being “separated out” too narrow – “featured” or “flagged” articles seem, to me at least, to be good uses for sticky articles and is immediately understood by clients. The ability to use status="sticky,live"
would allow one to interpret it either way.
TXP Builders – finely-crafted code, design and txp
Offline