Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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