Pimcore navigation on subsite

Non-bug-related support questions (How do/should I ... ?).

Pimcore navigation on subsite

Postby mickeysofine1972 » Thu Feb 23, 2012 6:06 pm

Hi all

Can someone please give me a quick review of the steps involved for making navigation on a subsite?

So far I've set two pages as having navigation setting and then included code in my view to render the items as stated in the tutorial

But the best I can get out of it is the page heading on the top of the nav but no links!

All help is welcome!

Mike
mickeysofine1972
 
Posts: 1
Joined: Thu Feb 23, 2012 6:03 pm

Re: Pimcore navigation on subsite

Postby paulg » Fri Feb 24, 2012 10:42 am

As a relative n00b, I'm not sure this is optimised for pimcore way of doing things, but tell your templates to use a different layout file.

This is boilerplate code I took from docs, and inserted a new parent doc node id (6) from which the nav should be generated. (ie the doc which is nominated as being the home page in my case 6)

subsite-layout.php
Code: Select all
<?php

// get root node if there is no document defined (for pages which are routed directly through static route)
if(!$this->document instanceof Document_Page) {
$this->document = Document::getById(6);
}
// get the document which should be used to start in navigation | default home
$navStartNode = $this->document->getProperty("navigationRoot");
if(!$navStartNode instanceof Document_Page) {
$navStartNode = Document::getById(6);
}
//this is used as id prefix for the html menu element
$htmlIdPrefix = "mainNav_";
$navigation = $this->pimcoreNavigation()->getNavigation($this->document, $navStartNode,
$htmlIdPrefix);
$this->navigation()->menu()->setUseTranslator(false); // to deactivate the translator provided by the view helper
$this->navigation($navigation);
?>

<?php $this->template('includes/subsite-head.php') ?>

<body>
    <h1>SUB-SITE LAYOUT</h1>
   
<?php
echo $this->navigation()->menu()->renderMenu($navigation, array("maxDepth" => 0));
?>
   
  <!-- BREADCRUMBS --> 
<div>
<a href="/">Sub-site Home</a> &gt;
<?php echo $this->navigation()->breadcrumbs()->setMinDepth(null); ?>
</div>
   
<?php echo $this->layout()->content ?>

(replace `subsite` with the name of your second site, obviously)

This came from another thread I found on here, cannot say where.

Hopefully if I am wrong someone will put us both right. ;)
paulg
 
Posts: 17
Joined: Wed Jan 18, 2012 12:02 am
Location: France


Return to General Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron