Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-08-03 20:03:25

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Allow plain text or a variable in the URL

Hi, I would like to add a plain text or a variable to the URL for use as a multilingual site please.

I want to allow URLs as example.com/en/section/ and example.com/en/section/id, where /en/ is just a plain-text or a variable/parameter that I can retrieve and use it to decide what content to display.

Until now I was using the plugin name gbp_permanent_links, but it isn’t working anymore in the latest TXP and PHP versions, and I also prefer not to use such a huge plugin for something that may be possible using with some short code to modify .htaccess or so please.

Here’s a link to an old topic where I use Bloke’s code to get the URL parameter:
https://forum.textpattern.com/viewtopic.php?pid=259866#p259866

Offline

#2 2021-08-03 20:53:20

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

Re: Allow plain text or a variable in the URL

I have a tiny unofficial plugin that does more or less that but it’s not gone through any extensive testing and really just does the prefix bit. It is working nicely on a couple of sites. You have mail…


TXP Builders – finely-crafted code, design and txp

Offline

#3 2021-08-03 21:22:22

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Allow plain text or a variable in the URL

Generating such links in recent txp is easy: just enclose your page in, say,

<txp:page_url root='<txp:site_url />en/'>
<!-- start page -->
...<txp:permlink />...
<!-- end page -->
</txp:page_url>

But to correctly interpret them you’ll need either .htaccess rewrite or <txp:php /> code or plugin.

Offline

#4 2021-08-04 11:58:53

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: Allow plain text or a variable in the URL

Thank you two very much!

jakob wrote #331204:

I have a tiny unofficial plugin that does more or less that but it’s not gone through any extensive testing and really just does the prefix bit. It is working nicely on a couple of sites. You have mail…

Thanks, it will be great to have your easy to use plugin works, I have replied your email with a link to a video showing the issue I got.

etc wrote #331205:

Generating such links in recent txp is easy

Thanks, it is always cool to see and learn new TXP magic stuff 🙌

Offline

Board footer

Powered by FluxBB