1

Topic: Customising the unlimited children nav

I'm trying to use the unlimited children nav code but I don't really need it to display the children pages but not the page that you are referencing as the start point of the tree.

The site I'm developing has two language branches which you can select using a pair of hard coded links separate to the main navigation, so i would like to omit the language homepage from the generated navigation as that is already selectable from the hard coded links.

I would also like to limited the result to just 2 levels (so you get one sub navigation per link) but i can't see where you might insert the -> children variable.

Any suggestions would be great.

Thumbs up

2

Re: Customising the unlimited children nav

Hi Tony - can I assume you're working off the code as it's found in the wiki?

Tony wrote:

I'm trying to use the unlimited children nav code but I don't really need it to display the
children pages but not the page that you are referencing as the start point of the tree.

You can indicate the "start point of the tree" in the code itself:

$page = $this->find('/');

Change the forward slash to the slug of the starting page (inside the quotes).

Tony wrote:

I would also like to limited the result to just 2 levels (so you get one sub navigation per link) but i can't see where you might insert the -> children variable.

I'm pretty sure that in this line of code:

echo displayChildren($page, $this, false, array('articles' => '3', 'a-sub-page' => '1'));

that last '1' is limiting the the menu generated to a single level; I expect that changing this to a '2' would get you the two levels you're after.

CAUTION - I'm not 100% sure about this, but hopefully someone more knowledgeable will correct any mistakes I've made! wink

3

Re: Customising the unlimited children nav

David wrote:

CAUTION - I'm not 100% sure about this, but hopefully someone more knowledgeable will correct any mistakes I've made! wink

Hi David

Hey!!! what's the worst that can happen wink
I'll give that a whirl around the block and see if the wheels fall off.

Thumbs up

4

Re: Customising the unlimited children nav

nah that didn't work on a few counts... in-fact it change not a jot.

I am starting to think it might be the lines in the snippet part of the code

function displayChildren($page, $current, $startmenu = true, $limits = null) {
  if ($limits != null && array_key_exists($page->slug, $limits)) {
    $arr = array('order' => 'position ASC, published_on DESC', 'limit' => $limits[$page->slug]);
  } else

but i'm not entirely sure how to change null to a value. ($limits = '2') perhaps?

I've got a similar issue with the sitemap generator... as I am using the email_template plugin... the message/success/fail pages all appear in the sitemap tree, which is less than perfect. but that's another issue.

Thumbs up

5

Re: Customising the unlimited children nav

Tony wrote:

nah that didn't work on a few counts... in-fact it change not a jot.

At least you were forewarned. big_smile

Tony wrote:

I've got a similar issue with the sitemap generator... as I am using the email_template plugin... the message/success/fail pages all appear in the sitemap tree, which is less than perfect. but that's another issue.

Isn't that simply a matter of setting your "message/success/fail pages" status to "Hidden" instead of "Published" (from the drop-down beneath the editing area)?

6

Re: Customising the unlimited children nav

David wrote:

Isn't that simply a matter of setting your "message/success/fail pages" status to "Hidden" instead of "Published" (from the drop-down beneath the editing area)?

No the email_template seems to rely on the pages being visible... certainly the success and failure pages... as these need to be visible to the public anyway. Well i gues i will leave the nav as is... I don't want to invest anymore time into adding more than the essential  at this time.

Thanks David for the help either way... however i'm wondering... 'one man a forum does not make'.

Last edited by Tony (2009-10-17 12:14)

Thumbs up

7

Re: Customising the unlimited children nav

Tony wrote:

No the email_template seems to rely on the pages being visible... certainly the success and failure pages... as these need to be visible to the public anyway.

But "Hidden" just means "hidden from the nav" (you can check the page status docs, too). I've used tuupola's system, and I'm 99.837% certain that this should do the trick!

Tony wrote:

... however i'm wondering... 'one man a forum does not make'.

Understood ... but it's early days, in terms of community still. wink

Re: Customising the unlimited children nav

Tony wrote:

however i'm wondering... 'one man a forum does not make'.

Well, considering we're up to 66 users since the start (end of june '09) and most Frog users are only now beginning to realize Frog hasn't been touched since... I think we're doing okay. wink

Wolf CMS founder and lead developer
Please always check the Support forums and Wiki before asking. (My Ohloh account.)
Like Wolf CMS? Consider making a financial contribution.