Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
456 views
in Q2A Core by
edited by
Having just about worked out how to incorporate standard Q2A functions into a single custom page template via the qa-theme.php file, I just can't fathom what code is necessary to incorporate further content into a different page within my qa-theme.php file.

My qa-theme.php code starts:

<?php
 class qa_html_theme extends qa_html_theme_base
    {
        function main()
        {

           if ($this->request=='MY_CUSTOM_PAGE') {

?>

HERE IS WHERE I'VE PUT MY CODE - AND IT WORKS

<?php

} else
                qa_html_theme_base::main();
        }
    }
    ?>

 

But what code do I place in the qa-theme.php file, and whereabouts, to apply different modifications to another custom page (eg MY_CUSTOM_PAGE-2)?

 

Hoping someone can help.
by
edited by
just to clarify:

 class qa_html_theme extends qa_html_theme_base
    {
        function main()
        {
            if ($this->request=='MY_CUSTOM_PAGE') {

***********custom code in here************


I have copied all this  code , pasted it below and changed the name of the page to my other page but nothing shows on that other page and get error message:

Cannot redeclare class qa_html_theme in C:\wamp\www\q2a\qa-theme\Default\qa-theme.php on line 225

Is it actually possible to create modifications for TWO or more separate pages within the qa-theme.php?

Would love to know how (in layman's terms...).

1 Answer

+1 vote
by

This is really a question about the PHP language but I'll answer it anyway:

<?php

 
  class qa_html_theme extends qa_html_theme_base
  {
    function main()
    {
      if ($this->request=='MY_CUSTOM_PAGE') {
?>
        stuff for custom page 1
<?      
      } elseif ($this->request=='MY_CUSTOM_PAGE_2') {
?>
        stuff for custom page 2
<?      
      } // you can keep going with more elseif clauses
    }
  }
 
?>
by
You're a Diamond, gidgreen!

Was trying to find the solution in PHP for Dummies till about midnight last night - not especially recommended bedtime reading for a PHP Dummy, I have to admit - and was just about to have another go.

Basic stuff, I realise, but with this bit of knowledge I think I'll be able to achieve what I want. Thank you.

Great app!
...