Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
3.3k views
in Q2A Core by
I want to add page counter for the bottom of every pages. Please help.
Q2A version: latest
by
Do you mean the "Number of times the question was viewed" like the one present above?
by
Yes, I think he is talking about view counter. You can move view function to the place where you want for the q_view....
by
Yes I want to add view counter to the all the pages in addition to question view count. I want it to add bottom of the pages.

1 Answer

+2 votes
by

Thanks for the clarification, @jatin

@rgd, you need to hook your main() function as you plan on printing the views count at the end of page and I am assuming just above footer. Here is some sample code:

function main() {
    //print only on quesion pages
    if ($this->template == "question") {
        qa_html_theme_base::main();
        $viewcount = $this->content["q_view"]["views_raw"];
        $timetext = $viewcount == 1 ? "time." : "times.";
        $this->output('<div class="qa-above-footer-stats" style="height: 20px; width:200px;">');
            $this->output("This question was viewed ".$viewcount." ".$timetext);
        $this->output('</div>');
    } else {
        qa_html_theme_base::main();
    }
}
 
Add above in your theme's qa-theme.php file. Take care about over-writing functions. Lemme know if this helped.
by
Thank you very much. I did it.
But only show this in two lines and no number.

This question was viewed
times.
...