You are not logged in.
No difference. :( That trick does work, but
sort='FIELD(ID,<txp:variable name="ids" />)' and
sort="custom_9 asc" are giving same results (as expected when I think about it). The moment I add a
sort attribute to
offset gets broken. Or at least, they are not working as I would want. I don’t know why exactly.
Thanks anyway for trying to help me. Much appreciated. I’m feeling bad for spamming this thread about stuff that is not that much related to smd_if…. or it is? Maybe I should start a new topic in “How Do I…? & Other Questions” section. (edit: and I did… )
Sometimes simple thing make you spend hours and hours working. :(
Last edited by hamato (2009-02-25 19:41:33)
This is probably a stupid question, but here it is:
How do I access $_POST[ ] variables?
I can access $_GET[ ] variables with
urlvar:var_name, but what about post variables?
How do I access $_POST[ ] variables?
Not a stupid question at all because the plugin, ahem *cough* can’t access them. It’s a ridiculous oversight on my part and I can’t believe it’s taken over a year for someone to notice! Thanks for spotting it.
For the vageuly interested I started out using TXP’s built-in
gps() function which grabs either POST or GET, but if neither exist it sets an empty value (the ‘s’ of gps). When trying to testi if a value has been used (at all) this is no good, so I ripped out the
gps() calls and replaced them with (albeit unsafe)
$_GET calls. And promptly forgot to add
$_POST as well. D’oh!
I’ll have it fixed in no time. Here is some hold music…
Excellent, works like a charm!
Thanks a lot Stef :-)
Having great time with your indispensable
Now that we’re all doing lovely tags within tags, there’s an increased danger of whitespace creeping in where you don’t expect it. This might lead to problems, for example:
<txp:variable name="x" value=" 9 " /> <txp:variable name="y" value="1" /> <txp:smd_if field="txpvar:x" operator="lt" value="txpvar:y"> <txp:variable name="x"/> is less than <txp:variable name="y"/> </txp:smd_if>
Note the spaces around the x variable’s value. This interferes with the “less than” comparison & things go awry. Is this something that
smd_if could cater for or do we just need to be very careful?
Now that we’re all doing lovely tags within tags, there’s an increased danger of whitespace creeping in where you don’t expect it.
Glad you’re finding the plugin useful. There’s a kind of undocumented solution to the spaces thing (err, I think). If you are expecting a value (or a field) that may have spaces in it, add
:NOTAGS to the variable (e.g.
txpvar:x:NOTAGS). That strips out PHP and HTML tags from the string and also performs a
trim() to remove whitespace (because often simply removing tags leaves extraneous whitespace lying around).
If it helps any — and you can perhaps see a situation when you may need to trim extraneous spaces without stripping PHP/HTML tags — I could add a dedicated
TRIM modifier to the next version? Currently, the
NOSPACE modifier could be (mis)used if you like, but since it only works on
fields you’d have to switch your value/field attributes over which may or may not yield the desired true/false result from the plugin.
Let me know if you think a TRIM modifier would help (and any other modifiers you might consider useful — I could add them all at once).
Last edited by Bloke (2009-03-22 19:50:51)
Let me know if you think a TRIM modifier would help …
Thanks Stef, I think it would be a useful safety harness. And it would mean that we could keep some semblance of readability in the source code – so instead of:
<txp:variable name="height" value='<txp:upm_article_image><txp:upm_img_full_height /></txp:upm_article_image>' />
We could do:
<txp:variable name="height" value=' <txp:upm_article_image> <txp:upm_img_full_height /> </txp:upm_article_image> '/>
and not have to worry about blanks/tabs/newlines etc.
Blimey, you’re quick off the mark. Thanks.
Too quick for me! I’d just sat down to send you another suggestion: a
trim="1" attribute, to save having to use a modifier in both
All the best,