NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms_replacer_rts:frontend_render:breadcrumb-article [2009/07/12 09:56] Knut Heermann (flip-flop) |
english:phpwcms_replacer_rts:frontend_render:breadcrumb-article [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| **Alternative way of building a breadcrumb.** \\ | **Alternative way of building a breadcrumb.** \\ | ||
| - | It will show article title too and act different when in article list mode. //(Two explanations, {BREADCRUMB_ARTICLE} and {BREADCRUMB_ARTICLE:[X]} (using start-level))//. | + | It will show article title too and act different when in article list mode. \\ |
| + | This works different from default breadcrumb because it is level based. \\ | ||
| + | (Two explanations, **{BREADCRUMB_ARTICLE}** //(using start-level in rt)// and **{BREADCRUMB_ARTICLE:[X]}** //(using start-level in tag)//). | ||
| + | |||
| + | We don´t mean the ID of a category using the word level, but the number of the gradation of the levels to each other. \\ | ||
| + | Have a look: [[english/navigation/little-helper/level-lift#basis_level_and_id|Basis level and ID]]. | ||
| + | |||
| + | **Recommended:** If you have only one start-level over all please use the first variation of BREADCRUMB_ARTICLE. | ||
| Line 10: | Line 17: | ||
| ===== {BREADCRUMB_ARTICLE} ===== | ===== {BREADCRUMB_ARTICLE} ===== | ||
| - | **{BREADCRUMB_ARTICLE}** //Output begin in level 0// \\ | + | **{BREADCRUMB_ARTICLE}** //Output begins in the adjusted level in RT // $_breadcrumb_start_level = [Level]; \\ |
| ##Home > category_01 > category_01_03 > category_01_03_02 > Article-alias-Cat_01_03_03## | ##Home > category_01 > category_01_03 > category_01_03_02 > Article-alias-Cat_01_03_03## | ||
| Line 21: | Line 28: | ||
| **Autor:** Oliver Georgi http://phpwcms.de \\ | **Autor:** Oliver Georgi http://phpwcms.de \\ | ||
| - | **CMS Version:** >= 1.4.2 r334 \\ | + | **CMS Version:** >= 1.4.2 r334 \\ |
| - | **Version:** V1.0 \\ | + | **Update:** 2009/07/12 OG to V1.1 //(Advanced: Start-level in rt)// |
| + | **Version:** V1.1 \\ | ||
| Line 43: | Line 52: | ||
| * Alternative way of building a breadcrumb | * Alternative way of building a breadcrumb | ||
| * It will show article title too and act different when in article list mode | * It will show article title too and act different when in article list mode | ||
| - | + | * This works different from default breadcrumb because it is level based | |
| - | * V1.0 | + | * |
| - | * 2009/07/11 Oliver Georgi | + | * (c) 07/12/2009 Oliver Georgi |
| + | * | ||
| + | * V1.1 | ||
| * | * | ||
| * Forum: http://forum.phpwcms.org/viewtopic.php?p=118076#p118076 | * Forum: http://forum.phpwcms.org/viewtopic.php?p=118076#p118076 | ||
| Line 51: | Line 62: | ||
| * | * | ||
| * Tag: {BREADCRUMB_ARTICLE} | * Tag: {BREADCRUMB_ARTICLE} | ||
| - | - ---------------------------------------------------------------------------- */ | + | * ---------------------------------------------------------------------------- */ |
| + | |||
| + | // ----------------------------------------------------------------------------- | ||
| + | // OBLIGATE CHECK FOR PHPWCMS CONSTANTS | ||
| + | if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} | ||
| + | // ----------------------------------------------------------------------------- | ||
| if(strpos($content['all'], '{BREADCRUMB_ARTICLE}')) { | if(strpos($content['all'], '{BREADCRUMB_ARTICLE}')) { | ||
| - | |||
| - | $_breadcrumb_spacer = ' > '; | ||
| - | $_breadcrumb_link_prefix = '<b>'; | ||
| - | $_breadcrumb_link_suffix = '</b>'; | ||
| - | $_breadcrumb_link_attribute = 'class="breadcrumb-link"'; | ||
| - | $_breadcrumb = array(); | + | // Set level where to start with breadcrumb - default 0 = Root level |
| + | $_breadcrumb_start_level = 0; | ||
| + | |||
| + | // Separate Breadcrumb items with | ||
| + | $_breadcrumb_spacer = ' > '; | ||
| + | |||
| + | // Wrap inner link text by prefix/suffix <a> %PREFIX% Linktext %SUFFIX% </a> | ||
| + | $_breadcrumb_link_prefix = '<b>'; | ||
| + | $_breadcrumb_link_suffix = '</b>'; | ||
| + | |||
| + | // additional link attributes like class, rel, style | ||
| + | // remember there is no active link - active (last) item has no link | ||
| + | $_breadcrumb_link_attribute = 'class="breadcrumb-link"'; | ||
| + | |||
| + | |||
| + | ////// Do not edit below //////// | ||
| + | |||
| + | $_breadcrumb = array(); | ||
| + | |||
| + | if(count($LEVEL_ID) > $_breadcrumb_start_level) { | ||
| + | |||
| + | foreach($LEVEL_ID as $level => $item) { | ||
| + | |||
| + | if($level < $_breadcrumb_start_level) { | ||
| + | continue; | ||
| + | } | ||
| - | foreach($LEVEL_ID as $item) { | + | if($content['struct'][$item]["acat_hidden"] == false) { |
| - | + | $_breadcrumb[] = getStructureLevelLink( | |
| - | if($content['struct'][$item]["acat_hidden"] == false) { | + | ($content['cat_id'] == $item && $content['list_mode']) ? $content['struct'][$item]['acat_name'] : $content['struct'][$item], |
| - | $_breadcrumb[] = getStructureLevelLink( | + | $_breadcrumb_link_attribute, |
| - | ($content['cat_id'] == $item && $content['list_mode']) ? $content['struct'][$item]['acat_name'] : $content['struct'][$item], | + | $_breadcrumb_link_prefix, |
| - | $_breadcrumb_link_attribute, | + | $_breadcrumb_link_suffix |
| - | $_breadcrumb_link_prefix, | + | ); |
| - | $_breadcrumb_link_suffix | + | } |
| - | ); | + | |
| - | } | + | } |
| - | + | ||
| - | } | + | } |
| - | + | ||
| - | // Article | + | // Article |
| - | if($aktion[1]) { | + | if($aktion[1]) { |
| - | + | ||
| - | $_breadcrumb[] = html_specialchars( $content['article_title'] ); | + | $_breadcrumb[] = html_specialchars( $content['article_title'] ); |
| - | + | ||
| - | } | + | } |
| - | + | ||
| - | $_breadcrumb = implode($_breadcrumb_spacer, array_diff( $_breadcrumb , array('', NULL) ) ); | + | $_breadcrumb = implode($_breadcrumb_spacer, array_diff( $_breadcrumb , array('', NULL) ) ); |
| - | + | ||
| - | $content['all'] = str_replace('{BREADCRUMB_ARTICLE}', $_breadcrumb, $content['all']); | + | $content['all'] = str_replace('{BREADCRUMB_ARTICLE}', $_breadcrumb, $content['all']); |
| } | } | ||
| Line 98: | Line 134: | ||
| Enhanced version of the snippet before. You can define a start level, where the output begin. | Enhanced version of the snippet before. You can define a start level, where the output begin. | ||
| - | |||
| - | We don´t mean the ID of a category using the word level, but the number of the gradation of the levels to each other. \\ | ||
| - | Have a look: [[english/navigation/little-helper/level-lift#basis_level_and_id|Basis level and ID]]. | ||
| E.g. with the given structure: | E.g. with the given structure: | ||
| Line 138: | Line 171: | ||
| \\ | \\ | ||
| - | <code php |h rt_breadcrumb_article |h > | + | <code php |h rt_breadcrumb_article_start |h > |
| <?php | <?php | ||
| /** ---------------------------------------------------------------------------- | /** ---------------------------------------------------------------------------- | ||