Page Feature: Works but doesn't

Cupara

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.
 
I have finally decided that I need help with this. I managed to figure out how to get pages such as 'xportal home/page/test' but the problem is the page loads and of course kicks back the 'Page cannot be found' error. I checked the debug and it is pulling the data from the xportal_page table but the display is not working for some reason.

Thanks

template example??
 
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
 
Steve... the /page/ route already exists as a default within XenForo... You are trying to overwrite an existing function.
 
I thought it was /pages/ not /page/ that was default. Oh well I can use another way of doing it.
 
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.
 
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?
 
BTW, not sure if you can see this page but here is a link to my test page: http://xendirectory.net/content/test/

xenDirectory - Error

The requested page could not be found.

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
 
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.
 
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
Thanks ragtek, been doing that but the problem must lie in _getPageOrError but without a proper error I have no idea where to go.

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.
I removed that whole function as its not even used. Have anything else that could cause my page not to load?
 
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.
 
Finally got somewhere, I had to remove the permission stuff from my controller file, get this error now:
xenDirectory Test Area

Server Error

Input page array does not contain a valid link
  1. xPortal_Model_Content->getTemplateTitle() in xPortal/ControllerPublic/Content.php at line 17
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();
 
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.
 
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.
For the benefit of others, could you share what you determined to be the issue ?
 
Top Bottom