Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Multilingual URL parameter help
Hi, I’m having a multilingual site, where English is the second language.
I was using the plugin name gbp_permanent_links but it is not working on the latest TXP version.
What I need is to allow URLS with “en” plain-text, in the format of en/section/id:
“example.com/en/
“example.com/en/section”
“example.com/en/section/id”
Would like to get some help making it happen without the unsupported plugin please.
(The plugin doesn’t saves the data, even that it shows it did saved the data)
Offline
Re: Multilingual URL parameter help
Forgot to mention that I only need TXP to accept the en/
part in the URL.
I’m already taking care of all the permalinks in my content.
So as long as TXP will know to accept the en/
part in the URL then I’m all set.
I’m reading it using PHP and creates a variable base on it, so I don’t use the regular txp:site_url
or txp:permlink
tags anymore, just building my own URL with the variable.
Is it something I need to do in the .htaccess
file please?
Offline
Re: Multilingual URL parameter help
I didn’t get a chance to test it but I think mkp_if_en should do what you are looking for. It works strictly on the front-end but will allow you to customize the output in the way you need.
Let me know if you run into any problems.
Offline
Re: Multilingual URL parameter help
There is also the option on hand writing the URL-only titles in the write tab. I tested it and you can have en/title-here
. Not sure if it is a feature or a bug though. Also I’m not sure how it can be achieved with sections without the plugin
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: Multilingual URL parameter help
I have tried the plugin mkp_if_en
but when I try visiting a link with en
it returns the following error:
Parse error: syntax error, unexpected ')' in /public_html/textpattern/lib/txplib_misc.php(812) : eval()'d code on line 19
The above errors were caused by the plugin:mkp_if_en
Any idea what else can I try please?
Offline
Re: Multilingual URL parameter help
THE BLUE DRAGON wrote #302535:
I have tried the plugin
mkp_if_en
but when I try visiting a link withen
it returns the following error:This is why I should test things more when copying & pasting.
return ($parts[1]) == 'en') ? parse(EvalElse($thing, true)) : parse(EvalElse($thing, false));
Edit this to ($parts[1] == 'en')
or give me a few minutes and I will upload an update.
Edit: Okay, corrected plugin is available.
Last edited by michaelkpate (2016-11-01 15:07:51)
Offline
Re: Multilingual URL parameter help
michaelkpate wrote #302536:
Edit: Okay, corrected plugin is available.
Thanks, now I don’t get an error from the plugin, but when visiting example.com/en
, it goes to the regular error page.
Running Textpattern version: 4.5.7
Offline
Re: Multilingual URL parameter help
THE BLUE DRAGON wrote #302541:
Thanks, now I don’t get an error from the plugin, but when visiting
example.com/en
, it goes to the regular error page.
I will be busy for the next few hours but I have a solution in mind. Just need to work through it. So check back later.
Offline
Re: Multilingual URL parameter help
michaelkpate wrote #302542:
I will be busy for the next few hours but I have a solution in mind. Just need to work through it. So check back later.
Appreciate :)
Offline
Re: Multilingual URL parameter help
Version 1.1 of txp_mkp_en is now up.
Note: the example code also uses smd_if.
Basically you place the example code on the top of your error page. If a visitor to your site triggers an error page by visiting an en url, you can intercept the error and show them the proper section or article content.
Offline
Re: Multilingual URL parameter help
michaelkpate wrote #302563:
Version 1.1 of txp_mkp_en is now up.
Thanks, I do get the next syntax error:
Parse error: syntax error, unexpected ':' in /home2/itai/public_html/textpattern/lib/txplib_misc.php(812) : eval()'d code on line 23
The above errors were caused by the plugin:mkp_if_en
Basically you place the example code on the top of your error page. If a visitor to your site triggers an error page by visiting an en url, you can intercept the error and show them the proper section or article content.
I see so the URL remains with the en/
part, but the content changes, this is a nice workaround for certain sites, but for me it requires a lot of work with the template code as I got different templates for different sections, so it will be kind of messy but it is better than nothing I guess.
We really need a plugin that will let us do something like that, gbp_permanent_links was working good until the recent TXP versions, do any of you can bring it back to work? If it’s too much work then please do contact me and name a price.
Or maybe I will just downgrade the TXP if it will be the only way, but that’s not really a good move of course.
Offline
Re: Multilingual URL parameter help
THE BLUE DRAGON wrote #302567:
I see so the URL remains with the en/ part, but the content changes, this is a nice workaround for certain sites, but for me it requires a lot of work with the template code as I got different templates for different sections, so it will be kind of messy but it is better than nothing I guess.
I agree with you that is messy but it has the advantage (for me at least) of not being a black box. I find that comforting.
I actually have some semi-free time to actually shake this out so I’ll find where the syntax error is coming from.
Offline