Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.2k views
in Q2A Core by

simple question but could not find the answer yet:

I want to use an advanced theme to output some html if it is a question site, e.g. question URL:

http://www.question2answer.org/qa/12973/how-to-identify-main-page-from-custom-theme


How do I do this?

if ($this->template=='???') { ...

if ($this->request=='???') { ...

if ($this->content...

I assume the latter but do not know how...

 

2 Answers

+2 votes
by
selected by
 
Best answer

For the question view, you want:

 
($this->template=='question')
 
not to be confused with:
 
($this->template=='questions')
 
which is the question list.
 
See also qa-page.php
 

 

by
thanks for your answer:

($this->template=='question')

is working! great :)
by
addition: Within your widget you need to call:

function output_widget($region, $place, $themeobject, $template, $request, $qa_content) {
  if($template=='question') {
    // do stuff
  }
}
0 votes
by
function : q_view

value: @$q_view[raw][postid];
by
edited by
are you sure? How to set the postid?

How to call this correctly within the advanced theme?

I guessed it should be something like (but not working):

        if (isset($content['q_view'])) { ... }
?
by
no, its a function. when it is called you are viewing a question and it's ID is $q_view[raw][postid] . that's all
...