1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Page Feature: Works but doesn't

Discussion in 'XenForo Development Discussions' started by Mythotical, Jul 24, 2011.

  1. Mythotical

    Mythotical Well-Known Member

    EDIT: Removed code as it has changed and code that was here won't work at all.

    Feature now works thanks to all those that helped me out.
     
  2. masterchief

    masterchief Well-Known Member

    template example??
     
  3. Mythotical

    Mythotical Well-Known Member

    The template for the table entry is: page_test

    Contest of that template is:
    HTML:
    <div class="mainSection">
    Hello World
    </div>
    Page container is xportal_page:
    HTML:
    <xen:title>{$page.page_title}</xen:title>
    
    <xen:container var="$head.openGraph">
        <xen:include template="open_graph_meta">
            <xen:set var="$url">{xen:link canonical:page, $page}</xen:set>
            <xen:set var="$title">{$page.page_title}</xen:set>
        </xen:include>
    </xen:container>
    <xen:container var="$quickNavSelected">{$page.pid}</xen:container>
    <xen:container var="$head.canonical">
        <link rel="canonical" href="{xen:link 'canonical:page', $page}" /></xen:container>
    <xen:require css="pagenode.css" />
    <div id="pageNodeContent">
        <article>{xen:raw $templateHtml}</article>
        <div class="bottomContent">
            <xen:include template="share_page">
                <xen:set var="$url">{xen:link 'canonical:page', $page}</xen:set>
            </xen:include>
        </div>
    </div>
    Thanks
     
  4. Jaxel

    Jaxel Well-Known Member

    Steve... the /page/ route already exists as a default within XenForo... You are trying to overwrite an existing function.
     
  5. Mythotical

    Mythotical Well-Known Member

    I thought it was /pages/ not /page/ that was default. Oh well I can use another way of doing it.
     
  6. Mythotical

    Mythotical Well-Known Member

    Ok I get the same result as I originally posted. I may know the issue now as I took a second look with using /page/ and you are right as it is reserved as /pages/ is so I'm going to use /content/ instead. Think I need a few more data queries to gather info and start displaying the pages right.
     
  7. Mythotical

    Mythotical Well-Known Member

    Ok I move everything to localhost and still not working. I changed it to use /content/ instead of /page/. Any other ideas of why its not working?
     
  8. Mythotical

    Mythotical Well-Known Member

  9. ragtek

    ragtek Guest

    1. if you want, you can use page for your prefix, if you'll never use the xf pages. (just overwrite the route)
    2. I'm too lazy to check your code, but you should start debugging.
    Check your router, if your page_link is set
    if yes, next step=> check your controller if he "recives" the right page_link.
    if yes, next step => check what _getPageOrError is returning
    etc.....
    so you'll find the problem
     
  10. Kier

    Kier XenForo Developer Staff Member

    PHP:
    public function getPage()
    {
        
    $Pages $this->_getDB()->fetchAll('
            SELECT *
            FROM xportal_page AS page'
    );
    }
    Is never going to work, as you never return the value. You just query (all pages) and then the result is left sitting in the function.
     
  11. Mythotical

    Mythotical Well-Known Member

    Thanks ragtek, been doing that but the problem must lie in _getPageOrError but without a proper error I have no idea where to go.

    I removed that whole function as its not even used. Have anything else that could cause my page not to load?
     
  12. Kier

    Kier XenForo Developer Staff Member

    Add this to your controller:

    PHP:
    protected function _preDispatch($action)
    {
    die(
    'I made it into the controller');
    }
    Then run, and see if you get the message or not.
     
  13. Mythotical

    Mythotical Well-Known Member

    Added and ran, I get the message as stated.
     
  14. Mythotical

    Mythotical Well-Known Member

    Finally got somewhere, I had to remove the permission stuff from my controller file, get this error now:
    Now line 17 is:
    PHP:
                'templateTitle' => $pageModel->getTemplateTitle($page)
    All variables in the above line is defined through:
    PHP:
            $pageName $this->_input->filterSingle('page_link'XenForo_Input::STRING);
            
    $page $this->_getPageOrError($pageName);

            
    $this->_canonicalizeRequestUrl($page);

            
    $pageModel $this->_getContentModel();
     
  15. Mythotical

    Mythotical Well-Known Member

    Thank you all that helped, Kier thanks to your little debug method I managed to narrow down the issue. It is now working perfectly, now I can sleep and will test more when I wake.
     
  16. Digital Doctor

    Digital Doctor Well-Known Member

    For the benefit of others, could you share what you determined to be the issue ?
     
  17. Mythotical

    Mythotical Well-Known Member

    Activity session gathering in the controller was causing the issue, once I removed it then it started working.
     
    Digital Doctor likes this.

Share This Page