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

I've read all the Q's & A's here and I am still confused.. Like someone else's situation I have an overall header/site-nav/footer that I'd like to wrap around the Q&A pages. I've done this with many other applications using php include statments

<?php include('inc_logo_banner_nav.htm');?>

in the overall_head and overall_foot files

I copied the Candy theme and renamed it and will work with that.. but I am completely stumped on where to make this change..

I thought maybe I could do it in:

 function body()
   $this->output ('<?php include('inc_logo_banner_nav.htm');?>;

but that spit an error..

Parse error: syntax error, unexpected T_STRING in /home/mysite/public_html/question2answer/qa-include/qa-theme-base.php on line 264

Can I get some baby step help please??

I know I can put what I want in the custom head/foot in the layout section, but that means I have to maintain the included info in 2 places, I am really trying to avoid that...

Q2A version: 1.4.3

1 Answer

0 votes

I don't know what your whole qa-theme.php file looks like, but at first glance, you don't need the <?php before the include. The file is already wrapped in php. Just use include('inc_logo_banner_nav.htm'); and then qa_html_theme_base::body();

Also, for the nav, there is a special nav function to use, I would not use the body function.


I havent touched it (qa-theme.php in the template folder).. I thought I was doing good by working in qa-theme-base.php. I do not understand how to include this in the qa-theme.php as part of the template.

The nav I am including will not have any effect on Q2A.. its is the nav for the entire site.
no, you should not touch qa-theme-base.php at all. that's the core file. You should only edit qa-theme.php. Be sure to read the instructions on Advanced Theming here:

You only use qa-theme-base.php to get see which functions you want to customize in the qa-theme.php file.

Note, there is a big learning curve here, so prepare yourself. For better or worse, Q2A is an entirely new platform that doesn't use any existing frameworks. Don't get frustrated, though, it's actually quite easy, once you get the hang of it and see the underlying logic .
<sniff... sniff...>  I learn by example..  and I hate learning new stuff especially big learning curve stuff :) OK printed that page and will try to concentrate on it tonight.. I;m completely self taught, can usually rip apart and get code to do what I need to, but I guess you are right this one is written quite contrary to everything I;ve worked with and I;m very frustrated.. This is my 2nd install of Q2A, the first I did use the layout - custom html because the site is much smaller.. I may end up doing that for the time being here on this install also as I REALLy wanted to get it moving along..
self-taught, as well and a complete novice at PHP. I've spent weeks on Q2A now and I'm finally getting the hang of it. You need to be able to code a bit in PHP to get this customized properly, but advanced knowledge is not necessary. It's not as user-friendly as Wordpress out-of-the-box, but certain things are alot easier (e.g. creating widgets on Q2A is a breeze, once you figure it out).  I think the learning curve is worth it, as Q2A seems to have tremendous potential. Just hope the developer keeps coming out with new versions and more advanced developers contribute more plugins.
woooohooooo I got it! THANK you for making me stop and THINK!

so now.. all the way on the bottom is
just below the lower navigation.. where the hack did I pick that up from???

Ahh just did some tweakin on the header also and now its up there too.. ;(
FYI, the code below may help you. This is my code for my custom footer, which I used in the qa-theme.php. There are some coding conventions I probaly should have done differently, the for a footer this is fine.

function footer()
                $this->output('<DIV CLASS="qa-footer">');

            //my custom code goes in this file included here               
                             require_once 'footer.php';



                $this->output('</DIV> <!-- END qa-footer -->', '');
genius :) marked that thread for reference.. looking nice now :) Looks like I am ON for moving my forums and the look of the whole site tomorrow :)