Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2023-01-24 09:43:46
txp:variable in plugin
probably I’m very stupidly overlooking something here. But how can I access the global
$variables in a plugin, say admin side?
The variables a decleared in a form (with
<txp:variable name="this_name" value="this_value" />). I tried to parse that form (
parse_form()) in the plugin but it seems that they are somewhere else populated into the global namespace not just by parsing. The globals $variables remains
Can someone enlighten me.
Thanks in advance.
#2 2023-01-24 11:24:10
Re: txp:variable in plugin
Never mind. Figured it out. For future reference:
global $variable; require_once(txpath . '/lib/txplib_publish.php'); require_once(txpath . '/publish/taghandlers.php'); require_once(txpath . '/lib/txplib_html.php'); $form = safe_field('Form', 'txp_form', "name = 'form_name_with_txp_variables'"); parse($form); // now we have access to the $variables dmp($variable);