PDA

View Full Version : current URL (lang. witch with flag icons)


Ghostt
12-07-2010, 12:51 AM
I want to switch the language by clicking on a flag image and need the "current url parse". The flags are in the header template.

{current forum URL}/?langid=2
{current forum URL}/?langid=1

ive found a javascript solution here:
https://vborg.vbsupport.ru/showpost.php?p=930649&postcount=4

but isnt there a easyer way like "$vboptions[currentbburl]" or so.

you know what i mean?
the advantage is.. that you stay on the page were you were..

DataHero
12-07-2010, 08:08 AM
Using $vboptions[bburl] should work for you.

Ghostt
12-07-2010, 01:59 PM
Using $vboptions[bburl] should work for you.

no! because you dont understand what is "current page". the $vboptions[bburl] is just the forumhome!!
so if you are at the moment in a thread or forumdisplay page and you click on the flag you get redirected to forumhome so you don't stay on the samepage!!

Ghostt
03-31-2011, 08:03 PM
has noone a solution?

kh99
03-31-2011, 08:33 PM
I think you should be able to piece it together using values in $_SERVER (as described on this page: http://us2.php.net/manual/en/reserved.variables.server.php), but I'm not sure of the details.

The javascript solution in your OP seems like a good idea - it requires editing a .js file, but other than that it's not hard and the details have been figured out for you.

Ghostt
03-31-2011, 08:47 PM
ok ive used the javascript solution ..

/EDIT

i have found also a other way with a php plugin:

$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https')
=== FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$params = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
echo $currentUrl;

now i want to know which solution is nicer and better for the performance?

Ghostt
04-04-2011, 07:57 PM
no ideas which is better?

Ghostt
06-16-2011, 12:11 AM
how i can get the current forum id? is there allready a code aviable for it in vb?

BirdOPrey5
06-17-2011, 11:19 PM
how i can get the current forum id? is there allready a code aviable for it in vb?

It depends on what page you are on... For example it could be $forum[forumid], $foruminfo[forumid], or $thread[forumid]... maybe even $post[forumid].

So it depends where you want to use the code.

Ghostt
06-24-2011, 08:51 PM
thank you bro!
thats what i need