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

i want a fuction like :

<?php
if ( is_home() ) {
    
// This is the blog posts index
    
get_sidebar'blog' );
}

?>

for q2a (qa-theme.php) to use in out puts

tnx

Q2A version: 1.7
by
In what context are you doing this? What is the "get_sidebar" function for? You probably want to create a widget module and put it on the home page.
by
hi scott
no i make a welcome bar under menu :
    function header() // removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
        {   
            $this->output('<div class="qa-header">');
           
            $this->logo();                       
            $this->header_clear();
            $this->header_custom();

            $this->output('</div> <!-- END qa-header -->', '');

            $this->output('<div class="qa-main-shadow">', '');
            $this->output('<div class="qa-main-wrapper">', '');
            $this->nav_main_sub();
            $this->output('
        <div class="div1">

                <p>سوالات خود را در این سامانه مطرح نمایید</p>

</div>

            ', '');
        }



but i want to show :
$this->output('
        <div class="div1">

                <p>سوالات خود را در این سامانه مطرح نمایید</p>

</div>



just in home page !

tnx
by
for example i can use             if ($this->template=='question')   but what i cant use for home ?

2 Answers

+2 votes
by
selected by
 
Best answer

If you are asking how to check whether you're currently in the home page or not you can do this:

if (qa_request() === '') {
    echo 'This is the home page';
}

You can't use the layer's template member because that depends on the kind of page you are displaying. The "home page" is a location not a kind of page. In fact, you can set your home page to be the activity page or the Q&A page, for example.

Whether you want to use the output function to output the HTML is up to you. Considering this is giving you trouble, I'd advise you not to use it, for the sake of simplicity.

by
tnx pupi
but i dont know php
where can i put html codes for out put in :
if (qa_request() === '')
?
by
i try
        if ( ($qa_request == 'home') )
            $this->output('
HTML CODE
    ', '');

but it is not wordking yet
by
How to output HTML is a different question... Yes, you can output HTML by means of the output function. But I'm not sure why you are using

if ($qa_request == 'home')

That just won't work. Use the code I've given you
by
tnx a lot :X :X :X
0 votes
by
i use this code to out put my html in home page

if ($this->template=='qa') {
$this->output('

HTML Codes

            ', '');
        }

 

Thanks every body
by
That does not check if you're in the HOME page. That only checks if you are displaying the Q&A template. The Q&A template can be configured as the home page or not. E.G.: You could have the 'activity' page as the home page and your approach won't work. You need to use the request there
by
how i can use that like top code ?

can u make an example ?
by
I've updated my answer with the complete IF statement...
Here is a question with the same code structure you need... only thing it checks for the 'user' page and outputs different stuff: http://question2answer.org/qa/45082
...