Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
cbs_navigation_menu
Introduction
This plugin allows to create a custom navigation menu based on Textpattern sections and/or full external URL’s. You can choose which sections you want to display in which order and style the current section differently.
Or, instead of sections you can specify full URL’s (starting with http://, ftp://, mailto: or any other prefix) and they will be linked “as is”.
You can also specify access keys for each menu entry.
More information
For complete information about the plugin, please look at the official page on the Textpattern Resources Site.
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
Re: cbs_navigation_menu
I’ll answer some questions posted as comments on the official page of the plugin.
Question from Jo:
Would be a great plugin for me (exactly what I was looking for!) only I consistently get the following error: “Textpattern Warning: Unknown tag on line 911”. This only happens on second level archived pages, but on my main page the menu doesn’t output at all. I’m using the latest version of textpattern – any ideas?
Your error is related to the tags you use in your template, that’s why textpatten warns you that the tag is unknown. It has nothing to do with the plugin, it’s probably a typo in your template, for example a space char between “txp:” and the name of the tag.
Question from Warren:
Does this plugin only allow one instance (one menu) per page?
You can use as many instances as you want in the same page, no problem.
Last edited by cbeyls (2006-09-19 19:54:46)
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
#3 2006-09-23 12:22:32
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Re: cbs_navigation_menu
Looks interesting I’ll give it a try. Thanks.
Offline
Re: cbs_navigation_menu
Question from Marios:
<em>Would it be possible to have an attribute, to get the active section wrapped with span or strong and strip the anchor tags ?</em>
I’ll release a new version with a new attribute that allows to remove the anchor for the active section. Then, you don’t need to wrap the active section with a span or any other tag to make it appear differently. You can achieve that with CSS. Let me explain how.
Updated 2006-09-25: After reflexion and the addition of the ids attribute to the plugin, I changed my mind and I decided that the option will replace the anchor with a span tag as you suggested, instead of just removing it. This allows to preserve both the class and id attributes for a better control of CSS styling: they are applied to the span instead of the anchor. The new version of the plugin, including these features, is available now.
Last edited by cbeyls (2006-09-25 02:51:58)
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
Re: cbs_navigation_menu
New version up : v0.4
See the changelog for details.
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
Re: cbs_navigation_menu
This is VERY useful, except I had one problem – when using it for my main navigation, it would append the current section to the URL.
For example, on the homepage it would link correctly:
mysite.com/tech
But when in the tech section, it would link:
mysite.com/tech/tech
Any ideas?
Last edited by rossharvey (2006-09-25 08:01:26)
Offline
Re: cbs_navigation_menu
It seems that the tech section is not interpreted as a section, so the href in the anchor is just “tech” everywhere. Why? I don’t know yet.
- Does the section you are trying to link contain a “:” in its name?
- Can you tell me which Textpattern version you are using?
- Can you show me the markup that causes this error in your template?
- Are you using the clean URL mode?
- Is the incrimined section properly configured?
- Is your site URL properly set in the Textpattern preferences panel (without any starting “http://” or final “/”) ?
Last edited by cbeyls (2006-09-25 13:44:02)
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
#8 2006-09-25 20:03:11
- marios
- Archived Plugin Author

- Registered: 2005-03-12
- Posts: 1,253
Re: cbs_navigation_menu
cbeyls, great work.
I saw your other work on the moo.tools library as well, which sounds quite innovative.
(Didn’t have time yet to try out those, but I feel obliged to do so, once I finish my current work)
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#9 2006-09-26 07:30:36
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Re: cbs_navigation_menu
Working nicely…
Offline
Re: cbs_navigation_menu
Hi cbeyls, thanks for the reply. You will have to excuse me, the error was with your other plugin – cbs_category_list. I edited the code to fix the problem, to this…
<code>
$out[] = tag(str_replace(‘& ‘,’& ‘, $title),‘a’,’ href=”/’.$s.’/’.$name
</code>
<p>
Works fine now.
</p>
cbeyls wrote:
It seems that the tech section is not interpreted as a section, so the href in the anchor is just “tech” everywhere. Why? I don’t know yet.
- Does the section you are trying to link contain a “:” in its name?
- Can you tell me which Textpattern version you are using?
- Can you show me the markup that causes this error in your template?
- Are you using the clean URL mode?
- Is the incrimined section properly configured?
- Is your site URL properly set in the Textpattern preferences panel (without any starting “http://” or final “/”) ?
Last edited by rossharvey (2006-09-26 15:57:16)
Offline
#11 2006-09-26 18:57:42
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Re: cbs_navigation_menu
Hey Ross, which bit does this replace? Thanks, Lee.
Offline
Re: cbs_navigation_menu
Hi Lee, I can’t remember the line number – just search for the first few characters, there is only that one instance in the code so it should be easy to find.
<code>
href=”/’.$s.’/’
</code>
<p>
That is the area in which the edit is made. Sorry I cannot be more specific, I am on my home PC, and have forgotten my dev TXP install password :¬)
lee wrote:
Hey Ross, which bit does this replace? Thanks, Lee.
Offline
Re: cbs_navigation_menu
So, you removed this:
pagelinkurl(array('c'=>$name, 's'=>$section))
“pagelinkurl” is a Textpattern built-in function to create URL’s. Normally it works fine, so I’m curious to know why it doesn’t work on your website.
Also, why have you used the $s variable? In the original code above, it’s $section. By default it’s the same as $s, but it can change if you specify another section as parameter.
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline
Re: cbs_navigation_menu
I have no idea either, I looked at the pagelinkurl source code and couldn’t see why. I use 4.0.3 standard.
In the pagelink code above, you’re instantiating <code>$section</code> dynamically (and hence locally) using the <code>$s</code> variable within the array. Without that code, <code>$section</code> doesn’t exist. You instantiate <code>$s</code> in the intital attribute extraction, which is why it has to be used.
Offline
Re: cbs_navigation_menu
rossharvey wrote:
In the pagelink code above, you’re instantiating <code>$section</code> dynamically (and hence locally) using the <code>$s</code> variable within the array. Without that code, <code>$section</code> doesn’t exist. You instantiate <code>$s</code> in the intital attribute extraction, which is why it has to be used.
Let me explain it more clearly. $s is a global variable instantiated by Textpattern, which contains the current section name. At the beginning of the plugin function I declare I want to use it. Then, I extract the plugin attributes to instantiate them as variables using the extract() call. One of these attributes, ‘section’, becomes the $section variable. If the ‘section’ attribute is not specified, the default value of the $section variable will be the current section, which is stored in the global $s variable. So, if in your code change you use the $s variable instead of $section, it will work as long as you don’t specify the ‘section’ attribute with a section which is different from the current section. If you do, the links will point the the right categories but in the wrong section (the current one instead of the specified one).
My plugins : cbs_live_search (improved) – cbs_category_list – cbs_navigation_menu – cbs_gravatar (updated) – cbs_article_index – cbs_maintenance_mode (new) – cbs_section_language (new)
Offline