Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
33 views
ago in Q2A Core by

I want a user to be able to filter out questions written in a specific language, and do it using an url-parameter when entering the site. 

I am in qa-base.php accessing the url-parameter, but I can't seem to keep the variable value when I switch to some of the other pages. Trying with using session variable, but cant get it to work. 

    $thelang=qa_get('thelang'); // get from URL parameter if possible

    if(isset($thelang)){

        $_SESSION['thelang'] = $thelang;

        echo "<br>Got GET Parameter!<br>";        

    } else { // get from SESSION variable

        $thelang = $_SESSION['thelang']; // this part doesn't seem to work.

    }

Thanks for any help! Maybe there is better ways to save the variable between pages.

Q2A version: 1.8.4
ago by
Even if you get the session variable to work, how are you planning to do the filtering?
ago by
I just add a attribute to the questions table and filter the sql on that. Already solved. But need help with saving the variable when entering another page.
ago by
Problem solved now using session variable properly. Thanks anyway.
ago by
Nice to know that. But if you are modifying the core, and you are modifying the database query, you can get the GET parameter there only (on the DB access page) and use it right? Why need to use SESSION?

One issue with this filtering is you'll need to handle the pagination part also as the count used for pagination might be without the filtering.
ago by
True, I noticed that. Do you know anyone skilled in question2answer I could hire some hours to help me with some improvements? Please contact me at magnus@mixtive.com

Please log in or register to answer this question.

...