Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Semi-persistent general storage plugin
Perhaps now that 4.2.0 is out and smd_query, smd_if and smd_each are mature — not to mention that I’ve learnt a thing or three about TXP since this was released — I should revisit the plugin and polish it a little.
I for one would be be happy for it, though it appears to be seaworthy from my perspective, save a few minor aspects which are related to other tags playing with this. I’m trying to get a grip on using smd_vars and smd_if together first. One thing I’ve attempted to say using the various field attribute choices:
this is psuedo code:
<txp:smd_if variable-put-from-smd-var operator="eq" the-thing-it-might-be-equal-to>
Hurrah!
<txp:else />
Some alternative to variable-put-from-smd-var or nothing.
</txp:smd_if>
I’m trying it this way because I’m finding that <txp:variable /> and <txp:if_variable /> cannot use “smd-made-session-vars” in the context I’d like. Maybe not at all even? It isn’t only because I’m pre-pending a username to each variable name in order to create a mandatory name prefix for “user-owned” vars: I must have <txp:ign_user_info type="name" /> in use to retrieve the correct variable:
<txp:if_variable name='<txp:smd_var_get name="<txp:ign_user_info type="name" />_pubdate" />'></txp:if_variable>
This by itself returns the variable value I need by name:
<txp:smd_var_get name="<txp:ign_user_info type="name" />_pubdate" />
So I may need to try and load all session vars and “register” them as “temporary-per-page-load” vars in a native-TXP-usable shape. Would this approach be to long-winded or does something from smdpattern :) have an alternative?
I’m going to give that a shot and report back.
Would like to really get this one smokin’ and release it officially.
I’ll see if I can break it first!
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Re: Semi-persistent general storage plugin
My latest scenario with if Var usable now:
Post Temporary Variable:
<txp:php>if($_POST['pubbed']){$GLOBALS['variable']['pubdate']=implode(',',$_POST['pubbed']);}</txp:php>
Convert Posted Temporary Variable to Session Variable:
<txp:if_variable name="pubdate">
<txp:smd_var_put name="<txp:ign_user_info type="name" />_pubdate" value="<txp:variable name="pubdate" />" />
</txp:if_variable>
Declare each page load that a Session Variable should be a Temporary Variable:
<txp:variable name='<txp:ign_user_info type="name" />_pubdate' value="<txp:smd_var_get name="<txp:ign_user_info type="name" />_pubdate" />" />
- In the end, all Temporary Variables are identically named for all users and work for non-logged-in users.
- All my logged-in-users get those same variable converted into ones with their username as a prefix and are stored for later use (after they log back in next week, after they come back in a new tabs, etc…).
Last edited by whaleen (2009-11-20 02:55:52)
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Re: Semi-persistent general storage plugin
I may be way off base with some of these last posts. I think I’ve confused myself into a corner. My if_variable commands are not adding up. edit: Was due to not using single quotes in nested tags. Phew, that was close.
Last edited by whaleen (2009-11-20 03:44:37)
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Re: Semi-persistent general storage plugin
Is it possible that smd_vars is interfering with txp:if_variable, smd_if, and other iffy things? I’ll disable and try some new if var stuff.
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Re: Semi-persistent general storage plugin
Josh, this sounds all chinesse to me, but I’ve spotted this in your code:
<txp:smd_var_put name="<txp:ign_user_info type="name" />_pubdate" value="<txp:variable name="pubdate" />" />
You have to use single quotes for that code to work:
<txp:smd_var_put name='<txp:ign_user_info type="name" />_pubdate' value='<txp:variable name="pubdate" />' />
Or am I missing something?
Offline
Re: Semi-persistent general storage plugin
Josh, this sounds all chinesse to me, but I’ve spotted this in your code:
Thanks Julián. I did spot those too. Apologies for the sloppy code above. I’ll replace it up once I get my version working which is a bit different now. It all sounds Chinese to me at this point too. I think I was pretty far out in unknown territory. Hopefully someone who speaks Chinese can tell me if I was on the right path. :)
Another thing is that I’m finding I’m unable to use txp:if_variable at all. Something is wrong outside of what I’ve been talking about here and I don’t think it’s related but that is what is holding me up.
I’m also looking for an answer about wether or not one can use txp:variable as the name attribute of txp:if_variable like so:
<txp:if_variable name='<txp:variable name="match-this' />' value="match-this">
matched
</txp:if_variable>
Last edited by whaleen (2009-11-21 01:04:33)
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline