Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Simplifying some convoluted code

0 votes
asked May 11, 2017 in Q2A Core by delstone

Does anyone have some thoughts on how best to simplify what appears to be these pretty convoluted lines of code?

        $url = str_replace("\\", '/', dirname(__FILE__));
        $root = qa_path_absolute($url);

        $pos = strpos($url, 'qa-plugin/');
        $url = substr($url, $pos);

        $pos = strpos($root, 'index.php');
        $root = substr($root, 0, $pos);

        $url = $root . $url;

        $qa_content['q_list']['form']['hidden']['viewedquestionsurl'] = $url;

Q2A version: 1.7.4
commented May 11, 2017 by sama55
You should clarify what you want and IN(before) and OUT(After) at first.

Please log in or register to answer this question.