Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to access a form, from a specific theme please?
Hi,
I have multiple themes, I want to access a specific form, from a specific theme without having different names for the forms, how can this be done please?
My main use for this is for the rah_external_output plugin.
Example url: https://example.com/?rah_external_output=example
Can it be something like this?
https://example.com/my-theme-name1/?rah_external_output=example
https://example.com/my-theme-name2/?rah_external_output=example
Also, how to access a form, from a different theme using <txp:output_form />
or using PHP please?
Offline
Re: How to access a form, from a specific theme please?
BTW: is there a new replacement for the rah_external_output plugin nowadays please?
maybe something in the core of the new TXP?
Offline
Re: How to access a form, from a specific theme please?
THE BLUE DRAGON wrote #334320:
BTW: is there a new replacement for the rah_external_output plugin nowadays please?
maybe something in the core of the new TXP?
It is indeed in house now.
Go to Preferences>Admin>Advanced options and enable it.
Now there should be a new Advanced options link on the left menu. Click on it,and you will see three fields. This is how I populated them.
PHP functions enabled in txp:evaluate: md5, replace:preg_replace
Custom form template types Help:
;[js]
;mediatype="application/javascript"
;title="JavaScript"
[js]
mediatype="application/javascript"
[json]
mediatype="application/json"
[svg]
mediatype="image/svg+xml"
[xml]
mediatype="application/xml"
[txt]
mediatype="text/plain"
[csv]
mediatype="text/csv"
[htm]
mediatype="text/html"
[html]
mediatype="text/html"
Number of extra parser sweeps: 1
You can access the outputs similarly to how the rah_external_output plugin did. domain.tld/?f=form_name
.
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: How to access a form, from a specific theme please?
In addition to what Yiannis said, if you want to get the theme name that is in force at any point, you can use the page_url tag:
<page::url type="theme" />
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: How to access a form, from a specific theme please?
THE BLUE DRAGON wrote #334319:
I have multiple themes, I want to access a specific form, from a specific theme without having different names for the forms, how can this be done please?
My main use for this is for the rah_external_output plugin.
Example url:https://example.com/?rah_external_output=example
Can it be something like this?
https://example.com/my-theme-name1/?rah_external_output=example
https://example.com/my-theme-name2/?rah_external_output=example
Typically, themes are associated with sections, so this could be
https://example.com/section-of-theme-name1/?rah_external_output=example
https://example.com/section-of-theme-name2/?rah_external_output=example
Untested with rah_external_output
plugin, but this should work with core custom forms, once you set them up.
Also, how to access a form, from a different theme using
<txp:output_form />
or using PHP please?
At some moment it was decided that crossing a section (and thus theme) boundary would be a privacy/security risk, so you need php privs here:
<txp:php>
<!-- fetch a form without parsing -->
$form = fetch_form('my-form', 'my-theme');
<!-- or parse and output it -->
echo parse_form('my-form', 'my-theme');
</txp:php>
Offline
Re: How to access a form, from a specific theme please?
Thank you all very very much colak, Bloke, etc, it is always great to learn on new features and stuff in TXP 🤗💗
Happy new year 🎉🥳
Offline