yab_navigation – A navigation management plugin for Textpattern

Grab it here
yab_navigation_v0.1.beta.zip
or here
yab_navigation_v0.1.beta.tar.gz

There are a couple of browser issues this time, namely for Opera, all Internet Explorer versions and Konqueror. Some are CSS-related, some Javascript related. Because of these issues this is a beta release. I will try to fix these issues asap.

Feature Screencast

Feature Screencast of yab_navigation from trenc on Vimeo.

What you need to know

The navigation used and generated by yab_navigation is based on a »simple« template of Textpattern tags (<txp:variable />, <txp:section_list />, <txp:article_custom /> etc.). This navigation will be saved in a form called »yab_navigation« (Opps!). This form will be created automatically.

Since the navigation is saved in this form you can call the navigation with the following command in your page template:

<txp:output_form form="yab_navigation" />

And your articles you can call simply with:

<txp:if_individual_article>
  <txp:article status="4" limit="1" />
<txp:else />
  <txp:article status="5" limit="1" />
</txp:if_individual_article>

in your page template(s).

For your frontpage you need a section with the value »On front page« set to »yes« and the same title as the home_title in the configuration (see below).

That’s all actually, but

What you really need to know

Since Textpattern sections and articles are completly different in behaviour and database structure and they are not only pages – as maybe known from other CMS – this plugin can only be an approach, of course. For understanding the concept I have to explain something.

The first section on the left side in your backend navigation will represent your frontpage aka your home. So the name of this section is only shown in the plugin, The real name, which is shown as a link in your frontend navigation is set in the config (see below).

The first article (first list point) of every section in the backend navigation will represent the parent section in the frontend navigation. This article will always be fixed (status 5) and is not displayed in the frontend navigation. So the name of the article is only shown in the backend navigation.

The rest of the articles will be shown in the frontend navigation in the order you choose.

What you maybe need to know

When you install the plugin and you go to the backend navigation, your whole navigation is shown of the right.

Reload the site again

Now your navigation should be shown on the left side but maybe it looks weird. This is because the plugin reads the whole stuff from database and not from a navigation template, because this is still empty. You have to move a section to force the generating of the navigation template. When done, reload the backend page again.

Now you should see on the right side a place where you can see hidden or new detected sections – if they exist.

If something won’t work or you can’t see the navigation on the left side, go to you form templates and empty the yab_navigation form. Then begin anew in the navigation backend.

Useful things you need to know

Every new created section is hidden by default, you have to move it from the right side in your backend navigation. Every created article is hidden by default, except if it is the first article of a section, then it’s fixed.

Btw. hiding the first article of a section doesn’t really make sense. :)

Renaming a section or an article will not change the name of section or the URI of the article. It will only rename the title of the element. I’ve decided for this behaviour because of the URI consistence (»Cool URI’s don’t change!«).

If you ever delete or rename a section in the Textpattern section menu you are lost.
Not really but …
If you have deleted a section this way you only have to hide this section in the backend navigation. Next time (or after a reload) this section will disappear.
If you have renamed a section this way … uh … fucked up! You have have to empty the yab_navigation form and build your navigation in the backend anew. Sorry!

Really useful things you need to know

There are configuration options for the plugin. You will find them in an array $yab_nav_prefs in the plugin code:

Option Description Default
home_title The title of the frontpage. Has to be the same title as your frontpage section title. Home
sort The sort order for the articles position asc
active_class Active class for sections or articles active
passive_class Passive class for sections or articles passive
exclude_sections Here you can completly exclude sections from navigation listing (comma delimited) (empty)
exclude_articles Here you can set sections, which articles will not be listed in the navigation. Useful for a news section or a section which does not have a single article as content. And you can’t move other articles in this section in the backend. (comma delimted) (empty)
section_default_page Default page template when creating a section default
section_default_css Default CSS when creating a section default
section_default_rss Should be created sections include in RSS Feed? 0
section_default_frontpage Should be created sections on frontpage? 0
section_default_searchable Should be created sections searchable? 1
jquery_ui The link to the jQueryUI Script min. JS from Google CDN
article_limit Hard limit for backend navigation article list 30

If you develop sites locally with no internet connection or you don’t like Google, you can change the jquery_ui link to a local jQueryUI framework. If you want to minfy the script, you don’t need to load the complete jQueryUI framework. The only things you need are Core, Widget, Mouse and Sortable. (http://jqueryui.com/download)

The function yab_nav_gTxt below the configuration array is used for the localisation and language. You can edit this on your own.

Other things you need to know

Deleting sections or articles will not be implemented. For deleting sections or articles you have to go the standard way.
The rights management (user privileges) could be bypassed by this plugin, if you set the rights for this plugin lazier than other rights are (for example access to editing sections in the section tab).
The plugin does only know the article status fixed (5), live (4) and hidden (2). Other status – as draft or pending – will be overwritten!

Things you really don’t want to know

This plugin is made with some Javascript, jQuery, jQuery UI, XML (really), AJAX, PHP, Textpattern, Debian, Kate, Firefox/Iceweasel. I like the Allman style for php coding with a maximal measure of 80 chars – if you ever look at the plugin code. And if you have seen the feature screencast, this is made with recordMyDesktop and converted with mencoder.

Kommentar

  1. # - Fernando schrieb am 8. Dezember 2014, 14:17:

    Dear
    I came across with your plugin and I was wondering if you no longer work in this plugin. I watched the video you did and I liked it how your plugin works. (similar to the way the user constructs the menus in Wordpress)
    I hope some days you come back to resume with its development.
    Thanks in advanced
    Regards from Argentina

  2. # - trenc schrieb am 11. Dezember 2014, 18:02:

    Hi Fernando,

    currently I’m lack of time to work on this plugin. Does this beta version not working?

    trenc





Textile-Hilfe