Closed gestern closed 9 years ago
You can create widget type "Page menu" and select checkbox "Match All Pages within Given Deepness". Then place widget on site pages.
Simple widget template
<div class="navbar">
<?php echo recurse_page_menu($pages); ?>
</div>
<?php function recurse_page_menu($pages)
{
$return = '<ul class="nav">';
foreach($pages as $p)
{
$return .= '<li>';
$return .= HTML::anchor($p['url'], $p['title'], array(
'class' => $p['is_active'] ? 'current' : ''
));
if (!empty($p['widget']) AND $p['widget'] instanceof Model_Widget_Decorator)
{
$return .= $p['widget']->render(array('return' => TRUE));
}
if (!empty($p['childs']))
{
$return .= recurse_page_menu($p['childs']);
}
$return .= '</li>';
}
$return .= '</ul>';
return $return;
}
Still not working with "ErrorException [ 2 ]: Invalid argument supplied for foreach() ~ DOCROOT/layouts/careers.php [ 2 ]
":
EMERGENCY: ErrorException [ 2 ]: Invalid argument supplied for foreach() ~ DOCROOT/layouts/careers.php [ 2 ] in /var/www/clients/client0/web5/web/layouts/careers.php:2
DEBUG: #0 /var/www/clients/client0/web5/web/layouts/careers.php(2): Kohana_Core::error_handler(2, 'Invalid argumen...', '/var/www/client...', 2, Array)
#1 /var/www/clients/client0/web5/web/cms/system/classes/kohana/view.php(62): include('/var/www/client...')
#2 /var/www/clients/client0/web5/web/cms/system/classes/kohana/view.php(359): Kohana_View::capture('/var/www/client...', Array)
#3 /var/www/clients/client0/web5/web/cms/system/classes/kohana/view.php(236): Kohana_View->render()
#4 /var/www/clients/client0/web5/web/cms/modules/pages/classes/kodicms/controller/front.php(110): Kohana_View->__toString()
#5 /var/www/clients/client0/web5/web/cms/modules/pages/classes/kodicms/controller/front.php(45): KodiCMS_Controller_Front->_render(Object(Model_Page_Front))
#6 /var/www/clients/client0/web5/web/cms/system/classes/kohana/controller.php(84): KodiCMS_Controller_Front->action_index()
#7 [internal function]: Kohana_Controller->execute()
#8 /var/www/clients/client0/web5/web/cms/system/classes/kohana/request/client/internal.php(97): ReflectionMethod->invoke(Object(Controller_Front))
#9 /var/www/clients/client0/web5/web/cms/system/classes/kohana/request/client.php(114): Kohana_Request_Client_Internal->execute_request(Object(Request), Object(Response))
#10 /var/www/clients/client0/web5/web/cms/system/classes/kohana/request.php(997): Kohana_Request_Client->execute(Object(Request))
#11 /var/www/clients/client0/web5/web/index.php(165): Kohana_Request->execute()
#12 {main} in /var/www/clients/client0/web5/web/layouts/careers.php:2
Something totally wrong with cashes of Layouts<-->Pages<-->Snippets. The layout render doesn't see anything which have already changed in snippet.
@gestern layout don't have parameter $pages
. If you want render pages menu, you should create widget with type page menu
, set snippet (template) for this widget and in template place your code.
After then you should place widget on pages to block
There is a structure of pages:
I just want to show inside of "Careers" a list of child pages (Job Position 1, ...2.. 3), for which some custom field (If I understood right the purpose of "
Page fields
" inside ofPages|Content
) would be equal to 1.I do that through
Layout
. I've filled up a layout for "Careers" page with code above. But for some reasons I'm faced with "500 - Internal Server Error - Invalid argument supplied for foreach()
".