Переменная с текущим URL'ом

Post Reply
burn
Posts: 262
Joined: Wed Feb 01, 2017 11:27 am

Переменная с текущим URL'ом

Post by burn »

Здравствуйте,
возможно добавить переменную с текущим URL'ом ?
Хотим сделать переключение на нужный язык без переброса в корень сайта, т.е. если открыта галера и выбираешь другой язык, нужно чтобы только сменился язык, а страница осталась прежней.
Или подскажите как это можно сделать ?
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: Переменная с текущим URL'ом

Post by admin »

<? print_r($_GET); ?>

список всех переменных которые получает скрипт из урла

тагом можно вывести как

<!--GET_varname-->
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Переменная с текущим URL'ом

Post by filthlab »

Hi,
I have the same problem here - when changing the language the visitor should stay on the same page, just the language should be changed, for instance if the visitor is here:
http://filthlab.com/category/Amateur/ctr/3/
and change the language to DE, he/she should be just redirected to:
http://filthlab.com/de/category/Amateur/ctr/3/

Can't see how
<? print_r($_GET); ?>
will help for this
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: Переменная с текущим URL'ом

Post by admin »

When you do <? print_r($_GET); ?> for http://filthlab.com/category/Amateur/ctr/3/

you'll see something like
group_name = Amateur
order= ctr
page = 3

so it's easy to create a link like

/de/category/<!--GET_group_name-->/<!--GET_order-->/<!--GET_page-->/

this way you can create any link for example you'd like to have links like

http://filthlab.com/c-Amateur-ctr-3/ - all you have to do is to change template and that's it, so need to change the script.
Don't forget to run script update
filthlab
Posts: 118
Joined: Tue May 30, 2017 6:49 am

Re: Переменная с текущим URL'ом

Post by filthlab »

This will work for /categories/ dir only. Is there a way to define where the surfer is - mainpage, /categories/, /tube/, search?
Also, when some or all of the <!--GET_group_name-->/<!--GET_order-->/<!--GET_page--> is empty we will get invalid url.
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: Переменная с текущим URL'ом

Post by admin »

You can get this from $_SERVER for example
or <!--CURRENT_TEMPLATE-->
or just pass any extra variable in rewrites like &page_prefix=category and then use it in template like /<!--GET_page_prefix-->
Don't forget to run script update
Post Reply