Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea] Append parameters of current page #51

Closed
kernle32dll opened this issue Jan 27, 2012 · 0 comments
Closed

[Idea] Append parameters of current page #51

kernle32dll opened this issue Jan 27, 2012 · 0 comments

Comments

@kernle32dll
Copy link

Hi there,

We recently ran into a small problem with babel, and had to integrate this little hack to is, so it would work for our scenario:

One page of our website is basically just a pull-page, which dynamically shows content trough parameters passed via PHP GET. This page is avaliable in german and english, so linked both of them. Problem is, when the babel link is generated, the appended GET parameters are lost, and the page shows junk.

So, we created a nifty hack that appends the GET parameters of the CURRENT page to the babel link:

// Append parameters
unset($_GET['q']);

if(!empty($_GET)){
  $i = 0;
  foreach($_GET as $key => $value){
    if($i == 0)
      $url .= '?'.$key.'='.$value;
    else
      $url .= '&'.$key.'='.$value;
    $i++;
  }
}

Inserted just after line 91 in the "BabelLinks" Snippet (after the $url var has been filled with content).

Might be worth considering integrating into babel, or at least some idea for a more professional implementation.

Greetings,
Kernle 32DLL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants