Apply template to custom PHP application

Discussion in 'Customization & add-ons' started by eeikbon, Oct 18, 2012.

  1. eeikbon

    eeikbon New Member

    Joined:
    Feb 14, 2011
    Messages:
    5
    I have integrated my own custom PHP pages into amember v4 , but I want them to use the theme for rendering. I can't see any documentation on this, can someone tell me how to do this
  2. alex

    alex Administrator Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,020
  3. eeikbon

    eeikbon New Member

    Joined:
    Feb 14, 2011
    Messages:
    5
    I have gone through that section and created the template, what I want to know is how do I hook into the templates from my custom application page.
    So I have my_app.php under the members area, how do I call the template header etc. Do I have to import some PHP files or extend certain classes
  4. alex

    alex Administrator Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,020
    Sorry, what do you want to hook into?
    Do you want to include aMember's header/footer around your custom page?
  5. eeikbon

    eeikbon New Member

    Joined:
    Feb 14, 2011
    Messages:
    5
    Yes, thats what I need, the selected template header, footer and I will put my content in between
  6. alex

    alex Administrator Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,020
    Look at this:

    PHP:
    require_once 'amember/bootstrap.php';
     
    $t = new Am_View;
    $t->title "test";
    $t->content "My page between header and footer goes here!<br />";
    $t->display('layout.phtml');
     
  7. eeikbon

    eeikbon New Member

    Joined:
    Feb 14, 2011
    Messages:
    5
  8. beenet

    beenet New Member

    Joined:
    Dec 24, 2004
    Messages:
    11
    This code gave me errors too. The log file said "Route default is not defined".

    I'm new to aM 4. I've read the doc's related to Themes and Templates. I'm able to intergrate my amember pages with wordpress pretty easily. However, I'm unable to figure out how to apply my current wordpress theme with my custom php files that live outside of amember and wordpress. Can someone please share the code I can copy and past into my .php files. Thank you.

    BeeNet

    Code:
    require_once 'amember/bootstrap.php';
     
    $t = new Am_View;
    $t->title = "test";
    $t->content = "My page between header and footer goes here!<br />";
    $t->display('layout.phtml');
  9. beenet

    beenet New Member

    Joined:
    Dec 24, 2004
    Messages:
    11
    I just learned that I can include the wordpress core in my custom file and
    use its build in function to output header and footer:

    <?php
    define("WP_CACHE", false);
    define("WP_USE_THEMES", false);
    include_once("/path/to/wp-blog-header.php");
    get_header(); // WP function to output header

    //Your php code goes here

    get_footer(); // WP function to output footer

Share This Page