xTOC

Xtoc offers modified versions of the toc() function and some other functions of CMSimple. They have been modified by Till from NMuD (http://www.nmud.de) and been tested with CMSimple version 2.5 and version 2.6 fix9. It works with version 2.8 and later as well, but uses the old toc-function and not the new ones which are used in these later versions.

Inclusion:

The functions are called via the template.htm file. You include them by adding at the top of the template.htm file:

<?php include ($pth['folder']['template'].'/dokuphp/addons/xtoc/xtoc.html'); ?>

The xtoc.php file has to be placed in the folder where the template resides. In the template you do not use “toc()” but “xtoc()” as menu function.

However, if you plan to develop vertical or horizontal drop down menus, you say in your template file:

<?=xli($hc,'menulevel')?>

instead of

<?=xtoc()?>

.

Functions:

There are two different functions inside the xtoc.php file, which have influence on the menu system: xtoc() itself and one out of five different xli() functions. While the xtoc()-function of the xtoc.php file always has to be active (does not apply for using the xsearchbox() and the xnewsbox functions !!!), only one of the xli()-functions may be active. The other ones must be outcommented or removed. The xli()-functions offer the following functions:

(1)
normal menu function, just for control use. It checks whether the menu is working properly in an unchanged fashion.

(2)
adds H1-, H2-, and H3-headings as second but individual CSS classes. They offer individual handles for individual menu button styling. A second CSS class will be added to every menu button with the name of the header which has been used for an idividual page. The output will look like

<li class="My_Heading doc"><a href="/mysite/?My_Heading">My_Heading</a></li>

Now every button can have a different look. But be careful with this function. Older browser may not understand CSS double class names.

(3)
turns a clicked button to a clickable button. Originally, a clicked button cannot be clicked again.

(4)
adds categories or spaces to a menu. Typing in “category_” or “break_” and formating it as an H1-heading adds a space to a menu. Typing in “category_New Category” and formating it as an H1-heading adds the category “New Category” to the menu. “New Category” is not linked, it cannot be clicked. Spaces and Categories can be formated via CSS, since they have the CSS class “category”. Using “break_” adds a CSS class “break” instead of “category” (see IMG 1).

To remove spaces and categories, you first have to exchange your template with a template, that does not provide the xtoc funtionality (i.e. the “default” template). This turns the spaces and categories to real headings which now can be removed. Later you switch back to your original template. As an alternative, you use the MenuManager plugin of Jens Bröcher, which easily removes Categories and Breaks.

(5)
combines functions 3 and 4.

Additional functions:

(6)
Alternative search box for fiddling with its layout by CSS. After activation of this function and using “xsearchbox()” instead of “searchbox()” in the template.htm file, the text of the search click button will be removed. The button is empty and free do be underlayed with a background image without annoying text. If you do not need the other functions you can outcomment or delete all of them (even the xtoc() function!!!). They are not required for the xsearchbox() function!!!

(7)
Alternative breadcrumbmenu (locator) for a specific case of the category: It might be the case, that the first menu point should be defined as category (see IMG 2). If you do this, you will deal with two problems. The first menu point “My Site” will be shown correctly; but if the website is called, you always end up on the first page, the “Homepage”. And this page doesn’t show anything else than just the heading “category_My Site”. This is not nice.

The second problem: The breadcrumbmenu shows the first heading as “category_My Site” as well. And this doesn’t change if you click through the menu.

The solution of these problems:

1. We forward the call for the “Homepage” to the next page. We do it with the script:

#CMSimple header(’Location:?Welcome’);#

whereby “Welcome” is the second page in this case. The “Homepage” will never be shown anymore.

2. To cerrect the breadcrumb menu we activate the xlocator() function inside of the xtoc.php file by decommenting. In our template we use now the xlocator() function instead of the locator() function (<?php echo xlocator(); ?>). Now the breadcrumbmenu looks fine again (IMG 3).

(8)
Alternative CMSimple Newsbox: The CMSimple Newsbox function is a powerfull function which can even be extended. The normal newsbox() function shows on each page of a given website the same news text. The xnewsbox() function, however, has the possibility to show on every page a specific, alternative news text. This is optional, though. If a certain page does not have specific news, the main news are shown (or no news).

To achieve this we activate the xnewsbox() function by decommenting. And in our template we use now xnewsbox() instead of newsbox() (<?php echo xnewsbox(); ?>).

To generate the main news we generate a page with the heading “News”. This can be a H1 or H2 heading. It should be located at the end of the content file. The page will be hidden by the script:

#CMSimple hide#

Now the page is not shown in the menu as menu point anymore, but it is shown on every page as “default” news. However, to assign specific, individual news to a certain web page - for example the “Welcome” page - we generate a second news page with the heading “News2”, and we do it best as a subitem of the main news (H2 or H3). Additional individual news are headed by “News3”, “News4”, “News5” etc.

To connect the individual news (News2) with our “Welcome” page we add the following script to this page:

#CMSimple $news=”News2”;#

Here now, the news text appears which has been generated on the page called “News2”. Othere pages receive their specific news by adding #CMSimple $news=”News3”;#, #CMSimple $news=”News4”;# etc.

Finally, we have on each page of our site actually two areas which can be maintained by our CMS. These newsboxes do not only hold text but also images etc.

The xnewsbox() function can be used without any of the other functions. All of them can be removed or inactivated by outcommenting.


This Xtoc version has been tested with CMSimple v2.5 and v2.6 fix9.

Known Bugs:

There is one known bug. If you have activated function (4) or (5) and you call the “Sitemap” and want to print the Sitemap with the printlink() function, you will observe “break_” and “category_” as menu button, but not as space or category. While the Xtoc function is able to hijack the sitemap function (with the consequence of showing the break/category in the sitemap), it cannot hijack the print function without touching the cms.php functions too much. The CMSimple print function acts like a second user: it calls the shown page once more in order to show it in a printer friendly output. Hereby, the cms.php own li() function is used and not the external xli() function anymore.

The latest version of Xtoc can be downloaded from
http://www.nmud.de/downloads/xtoc1beta5.zip

The download page can be accessed at
http://www.nmud.de/cmsimple-templates/downloads.shtml

see also: advanced_toc, JS Tree Menu

back to addons

addons/xtoc.txt · Last modified: 2007/11/26 17:36 by 84.170.141.201