Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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.
Offline
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.
Hire 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.
Offline
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.
Hire 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.
Offline
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.
Offline
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
Re: sticky
jakob wrote:
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.
In the old versions of txp (was it 4.0.4 and earlier?) stickies were much easier to handle. i agree with you that the comma delimited list would be so much more flexible. If more people agree and someone knows how to provide a patch for this I guess that a feature idea might roll things on.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#26 2009-04-17 11:33:51
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
colak,
I’m glad you found a solution but I’m still sure you could achieve what you want with smd_query.
I think me (and Bloke) have contributed to over-complicate things imagining a more complex scenario.
Probably you’ll stick with the workaround you found but just in case you have time and will to experiment you should try using my second example.
By the way, I noticed that in the first error you posted it complains you haven’t created a “my_form” form (of course you can choose an arbitrary name here).
Offline
Re: sticky
redbot wrote:
colak,
I’m glad you found a solution but I’m still sure you could achieve what you want with smd_query.
I think me (and Bloke) have contributed to over-complicate things imagining a more complex scenario.
Probably you’ll stick with the workaround you found but just in case you have time and will to experiment you should try using my second example.
By the way, I noticed that in the first error you posted it complains you haven’t created a “my_form” form (of course you can choose an arbitrary name here).
redbot, I saw that error and ‘corrected it’, (it was a typo during the creation of the form). I agree that there is a way using smd_query but my knowledge of mysql is extremely limited to none and I felt that I was using a lot of time from the people here so I opted to go the way I knew that it would work. It’s not perfect but have no complaints.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#28 2009-04-17 14:26:44
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: sticky
colak wrote:
so I opted to go the way I knew that it would work. It’s not perfect but have no complaints.
Ok, so problem is solved ;)
Offline