DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

CPS Breadcrumb Menu

refresh:60
Author:Christopher
Created:2010-12-18T19:57:23
Changed by:Roman Ott
Changed:2012-02-24T08:42:07.950000000
Classification:cps_breadcrumb
Description:The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ----
Keywords:breadcrumb, menu, cropping
Author:Roman Ott
Email:ott@cps-it.de
Language:en

img-1 img-2 CPS Breadcrumb Menu

Extension Key: cps_breadcrumb

Language: en

Version: 1.0.0

Keywords: breadcrumb, menu, cropping

Copyright 2006-2011, Roman Ott, ott@cps-it.de

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

`CPS Breadcrumb Menu 1 <#__RefHeading__5708_1738894311>`_

`Introduction 3 <#__RefHeading__5710_1738894311>`_

What does it do? 3

Screenshots 3

`Users manual 4 <#__RefHeading__467_413120346>`_

Use cropping functionality 4

Example Breadcrumb 4

Example Breadcrumb with tt_news 4

Configuration of typoscript example 5

FAQ 5

`Administration 6 <#__RefHeading__31511_818911409>`_

FAQ 6

`Configuration 7 <#__RefHeading__31515_818911409>`_

FAQ 7

Reference 7

`Tutorial 9 <#__RefHeading__31523_818911409>`_

`Known problems 10 <#__RefHeading__31525_818911409>`_

`To-Do list 11 <#__RefHeading__477_413120346>`_

`ChangeLog 12 <#__RefHeading__31623_818911409>`_

Introduction

What does it do?

The extension implements an automatic menu cropping if breadcrumb menu is longer than a defined length.

Extension maken an userfunction available for cropping, which can be used in every type of typoscript menu as itemArrayProcFunc. So you can implement and style your breadcrumb menu as usual with typoscript.

Also working breadcrumb menu example as static typoscript template available.

Screenshots

Here you see what the extension does:

img-3 Abbildung 1: Normal breadcrumb menu without cropping

img-4 Abbildung 2: breadcrumb with cropping

Live-Example: http://www.offenbach.ihk.de/

Users manual

  1. Please install the extension with typo3 extension manager.

Use cropping functionality

You can use cropping functionality for your own breadcrumb menu with this configuration

#includes userfunction for cropping
includeLibs.croppingBreadcrumb = EXT:cps_breadcrumb/res/class.croppingBreadcrumb.php



    1=TMENU
    1 {
      itemArrayProcFunc = user_croppingBreadcrumb->itemArray
      itemArrayProcFunc.maxLength = {$lib.cps_breadcrumb.maxLength}
      itemArrayProcFunc.searchFields = {$lib.cps_breadcrumb.searchFields}
      itemArrayProcFunc.replacementString = {$lib.cps_breadcrumb.replacementString}
      noBlur = 1
      wrap = <ul>|</ul>
      NO.stdWrap.cObject = COA
      NO.stdWrap.cObject {
        10 = TEXT
        10.field = nav_title // subtitle // title
         .........
      }
maxLength

itemArrayProcFunc

maxLength

Description

Define max length for the whole breadcrumb

Value

200 / Integer

Information

searchFields

itemArrayProcFunc

searchFields

Description

Defines the searchfields which are used in breadcrumb generation

Value

title, subtitle, nav_title

Information

e.g. using in generating TMENU10 = TEXT

10.field = title // subtitle // nav_title

replacementString

itemArrayProcFunc

replacementString

Description

Replacement string for cropping which replaces the menu element

Value

… / String

Information

Home >> Middle >> Lastwith croppinHome >> … >> Last

Example Breadcrumb

To
use the example breadcrumb menu you have to do following steps

Add static template breadcrumb to your page template

Assign lib.cps_breadcrumb to the correct marker of your breadcrumb

page.20 {
   marks {
        BREADCRUMB =< lib.cps_breadcrumb
        ...
                   }
}

Example Breadcrumb with tt_news

This
example typoscript template implements a breadcrumb menu with tt_news
support

Add static template breadcrumb with tt_news to your page template

Assign lib.breadcrumb to your breadcrumb marker

page.20 {
   marks {
        BREADCRUMB =< lib.cps_breadcrumb
        ...
                   }
}

Configuration of typoscript example

You
can configure both typoscript examples with setting constants in your
typoscript template constants.

This
constants are available in the examples:
#defines max length fro cropping menu
lib.cps_breadcrumb.maxLength = 60

#fields in your typoscript for menu labels
lib.cps_breadcrumb.searchFields = nav_title,subtitle,title

#fields for breadcrumb generation similar to cropping fields
lib.cps_breadcrumb.menuFields = nav_title // subtitle // title

#replacement string if menu is cropped
lib.cps_breadcrumb.replacementString = ...

#path to css file for example
lib.cps_breadcrumb.cssFile = EXT:cps_breadcrumb/res/cps_breadcrumb.css

#spacer between menu-items
lib.cps_breasdcrumb.menuSpacer = &raquo;

FAQ

How can I change the maximal length for cropping the breadcrumb menu?
You
can set the max length via constants in your typoscript (see
configuration of typoscript example. If you have a own breadcrumb
menu and use only userfunction for cropping, then you have to use the
conf param maxLength for userfunction. (see Use cropping
functionality)
What parts of breadcrumb count for cropping max length value?
There
only count the length of array menu item in the item array which is
displayed. Spacer characters dont count for max length calculation in
cropping user function.
How can I change the replacement string?
You
can change the replacement string via constants in typoscript if you
use example typoscript from extension. (see example breadcrumb) Using
your own breadcrumb menu you have to configure the replacement string
with conf param replacementString for userfunction (see Use cropping
functionality)

Administration

Cropping
functionality uses an automatic processing function in the typoscript
configuration for TMENU.

First
for using typoscript configuration, you have to implement the class
with userfunction via includeLibs  statement.

e.g.
includeLibs.croppingBreadcrumb = EXT:cps_breadcrumb/res/class.croppingBreadcrumb.php
In TMENU we can
use the function “itemArrayProcFunc” and implement an own
userfunction.


The
content for the userfunction contains at this moment the complete
breadcrumb menu as menu array. That means we have only the values of
the processed menu items.

No
formating, no special characters. In this array menu we have all
fields of menu items which are configured in typoscript.

This
userfunction needs 3 userfunction params. MaxLength, searchFields and
replaceString.

SearchFields
are important to check the menu array for the correct fields given in
typoscript configuration and to cropp the correspending menu item
values.






Also
cropping userfunction makes it possible to calculate extra breadcrumb
elements which are appended to the breadcrumb menu e.g. the title of
news article (tt_news) in detailview or the eventstitle in detailview
or any other extension.

To
make a cropping for this elements available there is an Global
Register Value, which has influence on calculation.






Example:
[globalVar = GP:tx_ttnews|tt_news > 0]
lib.cps_breadcrumb.20.1.stdWrap.append = RECORDS
lib.cps_breadcrumb.20.1.stdWrap.append {
      wrap = <li>|</li>
      tables = tt_news
      source.data = GP:tx_ttnews|tt_news
      source.stdWrap.prioriCalc = intval
      conf.tt_news = COA
      conf.tt_news.20 = TEXT
      conf.tt_news.20.field = title
      conf.tt_news.20.wrap = {$lib.cps_breasdcrumb.menuSpacer}&nbsp;|
}
[GLOBAL]
We have an
condition that typoscript is only processed if there is an get-param
in url from tt_news for detailview. Here we append the news title to
the cropping menu. This news title is not  in the menu array for
croppin, so has no influence for calculation of cropping.






















Solution:
### Breadcrumbs Typoscript
lib.cps_breadcrumb = COA
lib.cps_breadcrumb {
  10 = LOAD_REGISTER
  10 {
    extraItem.cObject = RECORDS
    extraItem.cObject {
      tables = tt_news
      source.data = GP:tx_ttnews|tt_news
      source.stdWrap.prioriCalc = intval
      conf.tt_news = COA
      conf.tt_news.20 = TEXT
      conf.tt_news.20.field = title
    }
  }

  20 = HMENU


In our
breadcrumb typoscript object we create an register  extraItem”.

This
register object has influence for the cropping functionality. The
value in the Global Register extraItem takes effect in the maxLength
calculation for breadcrumb.

In
our example the register contains the title of new-items

You
can add additional register and then change correspending typoscript.

Tutorial

There
is no tutorial. See example typoscript how to use cropping
userfunction

Known problems

No
known problem yet

To-Do list

-
make a frontend plugin for inserting breadcrumb menu

ChangeLog

Please
see ChangLog in EXT:cps_breadcrumb/ChangeLog