Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-08-05 07:32:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Allow txp tags in html type forms

Reason for the request: One site I keep on coming across through my circles is Linktree which I find superfluous, but at the same time I can understand the functional necessity for people who do not have a basic knowledge of html.

As such, I thought I could do a basic html design that emulates the functionality of linktree and link to that in social media sites.

The issue, at the moment, is when I create an html form, txp tags do not parse, and I cannot update it dynamically.

Is there a reason that txp tags are not working in htm/html forms?

Edited to add that txp tags used to parse in previous txp versions. I’m currently using Textpattern version: 4.9.0-dev (d72fbb8ac8a902583c01b17537647986)

Last edited by colak (2024-08-05 10:02:55)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2024-08-05 13:12:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: Allow txp tags in html type forms

Hi Yiannis,

Not sure if I’ve understood what you mean by txp:tags in an html form. Are you trying to create a public-facing (or pw-protected but public) form that allows people to submit their links and have them added to Textpattern’s database? If so, I think you need etc_post (and here) for that and make it hook up to the link save event & step.

If it’s something else, could it be something to do with single/double quotes? Or can you show us an example of what you mean?

If you’re after a basic linktree-like template, I have a simple single-page template that I made as a temporary holding page for a future website. It uses Textpattern’s links, downloads and a collection of background images that are shown randomly. That doesn’t have any public submission mechanism: you simply add links and downloads via Textpattern. Let me know if that is of interest.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2024-08-05 14:40:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Allow txp tags in html type forms

jakob wrote #337552:

Hi Yiannis,

Not sure if I’ve understood what you mean by txp:tags in an html form. Are you trying to create a public-facing (or pw-protected but public) form that allows people to submit their links and have them added to Textpattern’s database? If so, I think you need etc_post (and here) for that and make it hook up to the link save event & step.

I’m trying to create a txp powered .htm ending page in the Presentation>Forms tab. I made a number of them in the past 2 years without an issue.

In Admin>Preferences>Advanced options I added

[htm]
mediatype="text/html"

and saved the aforementioned form with

<txp:header name="Cache-Control" value="no-cache, no-store, must-revalidate" />
some straight html
<txp:article_custom section="blog" limit="4" c10="" status="live" break="li" wraptag="ul" />
etc

The tags did not parse.

If it’s something else, could it be something to do with single/double quotes? Or can you show us an example of what you mean?

nope:(

If you’re after a basic linktree-like template, I have a simple single-page template that I made as a temporary holding page for a future website. It uses Textpattern’s links, downloads and a collection of background images that are shown randomly. That doesn’t have any public submission mechanism: you simply add links and downloads via Textpattern. Let me know if that is of interest.

I have designed a basic one here, where you can see how the <txp:header name="Cache-Control" value="no-cache, no-store, must-revalidate" /> is not parsed.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2024-08-05 16:39:01

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: Allow txp tags in html type forms

What happens if you remove the mediatype? That already sets a header so maybe it’s hindering txp:header from working, though that doesn’t explain why txp:article is not working. Will the form parse then?

And if you try accessing it with domain.com/?f=your-form-name?

I’ve seen the URL of your page now and you are accessing the form directly by its path on the site. It’s not something I’ve tried before (probably because the standard .txp form ending is not recognised by the browser), but if it accepts .htm, then that must be the result of adding .htm as an additional form type. If you try accessing the form via https://www.neme.org/?f=linktree.htm, you’ll see the txp:header tag is being parsed (the browser dev tools confirm that too). I can’t tell if the txp:article_custom is being parsed because the page looks otherwise identical when calling the form using each method.

If calling a form using .htm worked before, something may have changed. Otherwise, you could make the /?f=linktree.htm easier to access via one of two methods:

  • Add a rewriteRule to your .htaccess file that rewrites https://www.name.org/linktree.htm to https://www.neme.org/?f=linktree.htm, or
  • Make a mini plugin along the lines shown in this post. That allows you to specify an url and the form name it should show.

TXP Builders – finely-crafted code, design and txp

Offline

#5 2024-08-06 05:05:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Allow txp tags in html type forms

Thanks so much Julian! Accessing the page using https://www.neme.org/?f=linktree solved the issue. I’ll work on an htaccess rule later today!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2024-08-06 08:24:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Allow txp tags in html type forms

After thinking about it, I now understand that my request was not possible as static pages cannot be parsing tags. As such, I’m moving this to the “How do I…?” section.

Julian, many thanks again for helping me to see this.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB