NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms_replacer_rts:frontend_render:xbrowse-next-prev-up [2010/07/09 15:47] Knut Heermann (flip-flop) created |
english:phpwcms_replacer_rts:frontend_render:xbrowse-next-prev-up [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ====== {XBROWSE:NEXT/PREV/UP:LinkText:X} ====== | ====== {XBROWSE:NEXT/PREV/UP:LinkText:X} ====== | ||
| - | An extended [[http://www.phpwcms-docu.de/navigations_tags_.phtml|(BROWSE :....}]] tag, which can output optional link text as the article title/subtitle or category title. In the Product List mode, a loop is adjustable, which braches in PREV from the first to the last and in NEXT from the last to the first article. The familiar settings from the tag [[http://www.phpwcms-docu.de/navigations_tags_.phtml|{BROWSE:....}]] can be used. | + | An extended [[http://www.phpwcms-docu.de/navigation_tags.phtml|(BROWSE :....}]] tag, which can produce optional link texts like the article title/subtitle or category title. In the Product List mode, a loop is adjustable, which branches in PREV from the first to the last and in NEXT from the last to the first article. The familiar settings of the tag [[http://www.phpwcms-docu.de/navigation_tags.phtml|{BROWSE:....}]] can be used. |
| + | \\ | ||
| + | |||
| + | You can adjust it in the script: | ||
| + | * An alternate text for the case that there is no link | ||
| + | * the maximum number of characters for the link text | ||
| + | * trailing char/string when maximum number of characters is exceeded | ||
| + | * Prefix/suffix if no link has been generated //(E.g. in mode :0)//. | ||
| + | |||
| + | |||
| + | It is automatically generating CSS classes for the states "no link", "first link" in PREV if the first link is left out, the "last link" in NEXT if if the last link is left out, if it is linked to a category. | ||
| + | |||
| + | <note important>This TAG replaces the TAG [[english/phpwcms_replacer_rts/frontend_render/xbrowse-up]]. //(Please do not use both at the same time in parallel).// </note> | ||
| + | |||
| + | \\ | ||
| ===== Description: ===== | ===== Description: ===== | ||
| Line 11: | Line 25: | ||
| **{XBROWSE:UP:LinkText}** or e.g. **{XBROWSE:UP:^^ | ^^}** \\ | **{XBROWSE:UP:LinkText}** or e.g. **{XBROWSE:UP:^^ | ^^}** \\ | ||
| * **LinkText** = freely definable link text | * **LinkText** = freely definable link text | ||
| - | * **|** = Platzhalter für Kategorietitel \\ | + | * **|** = Placeholder for the category titel \\ |
| - | Unterschiedlicher Rücksprung aus einer Kategorie/Artikel bei einfachem Artikelmodus oder Listen-Artikelmodus. -> [[deutsch/phpwcms-system/artikel#darstellungsmodi|Darstellungsmodi]] | + | |
| - | - Gehe zurück zur Kategorie //(Artikel Listenmodus)// wenn der Benutzer sich im Artikeldetail befindet //(Artikel-Listenmodues aktiv)//. \\ | + | - Browse up to the category //(article listing)// if the user is in article detail view //(article listing mode set)//. \\ |
| - | - Gehe zurück zur Elternkategorie wenn der Benutzer sich im Artikeldetail //(einfacher Artikelmodus)// oder in der Kategorieansicht befindet. | + | - Browse up to the parent category if the user is in article detail view //(simple article mode)// or category view. |
| - | **{XBROWSE:PREV:LinkText:2}** oder z.B. \\ **{XBROWSE:PREV:<< | <<:2}** oder **{XBROWSE:PREV:<< || <<:2}** oder **{XBROWSE:PREV:<< | || <<:2}** \\ | + | |
| + | **{XBROWSE:PREV:LinkText:2}** or e.g. \\ **{XBROWSE:PREV:<< | <<:2}** or **{XBROWSE:PREV:<< || <<:2}** or **{XBROWSE:PREV:<< | || <<:2}** \\ | ||
| * **LinkText** = freely definable link text | * **LinkText** = freely definable link text | ||
| * **|** = Placeholder for the article title in freely definable link text | * **|** = Placeholder for the article title in freely definable link text | ||
| Line 28: | Line 42: | ||
| \\ | \\ | ||
| - | This tag can be used alternatively to the built-in tag [[http://www.phpwcms-docu.de/navigations_tags_.phtml|{BROWSE:NEXT/PREV/UP:LinkText}]]. | + | ==== Parameter in the script: ==== |
| + | |||
| + | <code php> | ||
| + | // ************ CUSTOM VAR *********************************************** | ||
| + | |||
| + | $up_no_linktext = '--'; // +KH: if no link is available | ||
| + | $up_max_char_count = 30; // +KH: max chars in link text | ||
| + | $up_max_char_affix = '…'; // +KH: affix if > max_char_count | ||
| + | $up_prefix_no_link = '<span class="xbrowse-unolink">'; | ||
| + | $up_sufix_no_link = '</span>'; | ||
| + | |||
| + | $next_no_linktext = '--'; // +KH: if no link is available | ||
| + | $next_max_char_count = 30; // +KH: max chars in link text | ||
| + | $next_max_char_affix = '…'; // +KH: affix if > max_char_count | ||
| + | $next_prefix_no_link = '<span class="xbrowse-nnolink">'; | ||
| + | $next_sufix_no_link = '</span>'; | ||
| + | |||
| + | $prev_no_linktext = '--'; // +KH: if no link is available | ||
| + | $prev_max_char_count = 30; // +KH: max chars in link text | ||
| + | $prev_max_char_affix = '…'; // +KH: affix if > max_char_count | ||
| + | $prev_prefix_no_link = '<span class="xbrowse-pnolink">'; | ||
| + | $prev_sufix_no_link = '</span>'; | ||
| + | |||
| + | // ************ END CUSTOM VAR ******************************************* | ||
| + | </code> | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ====== ====== | ||
| + | |||
| + | |||
| + | |||
| + | This tag can alternatively be used for the built-in [[http://www.phpwcms-docu.de/navigation_tags.phtml|{BROWSE:NEXT/PREV/UP:LinkText}]]. | ||
| ---- | ---- | ||
| \\ | \\ | ||
| Line 34: | Line 81: | ||
| Docu: -- \\ | Docu: -- \\ | ||
| - | Forum: [[http://forum.phpwcms.org/viewtopic.php?f=16&t=19936]] | + | Forum: -- |
| Line 50: | Line 97: | ||
| Folder: ** template/inc_script/frontend_render/ ** | Folder: ** template/inc_script/frontend_render/ ** | ||
| - | **Bedingung:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ | + | **Condition:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ |
| * ##$phpwcms['allow_ext_render'] = 1;## | * ##$phpwcms['allow_ext_render'] = 1;## | ||
| Line 87: | Line 134: | ||
| * "Link Text" or | or || | * "Link Text" or | or || | ||
| * = "Link Text" or "Link article title" or or "Link article subtitle" | * = "Link Text" or "Link article title" or or "Link article subtitle" | ||
| - | * off = no jump to the next/prev category if the article is the last/first one | + | * 0=off = no jump to the next/prev category if the article is the last/first one |
| - | * on = next/prev category follows last/first article | + | * 1=on = next/prev category follows last/first article |
| - | * loop = last/first article follows first/last article in list mode | + | * 2=loop = last/first article follows first/last article in list mode |
| * | * | ||
| * | * | ||
| Line 115: | Line 162: | ||
| $up_no_linktext = '--'; // +KH: if no link is available | $up_no_linktext = '--'; // +KH: if no link is available | ||
| $up_max_char_count = 30; // +KH: max chars in link text | $up_max_char_count = 30; // +KH: max chars in link text | ||
| - | $up_max_char_affix = '…'; // +KH: affix if > max_char_count | + | $up_max_char_affix = '…'; // +KH: affix if > max_char_count |
| - | $up_class_no_link = 'span'; | + | $up_prefix_no_link = '<span class="xbrowse-unolink">'; |
| + | $up_sufix_no_link = '</span>'; | ||
| $next_no_linktext = '--'; // +KH: if no link is available | $next_no_linktext = '--'; // +KH: if no link is available | ||
| Line 138: | Line 186: | ||
| // UP ========================================================== | // UP ========================================================== | ||
| - | function xget_index_link_up($linktext, $no_linktext, $max_char_count, $max_char_affix,$class_no_link) { | + | function xget_index_link_up($linktext, $no_linktext, $max_char_count, $max_char_affix,$prefix_no_link,$sufix_no_link) { |
| Line 164: | Line 212: | ||
| } | } | ||
| + | $linktext = str_replace('||','',$linktext); // +KH | ||
| + | |||
| + | // Is there any placeholder in linktext and link available? | ||
| + | if (!$link AND strpos($linktext, '|')) | ||
| + | $linktext = str_replace('|', $no_linktext, $linktext); | ||
| + | |||
| // generate the linktext | // generate the linktext | ||
| $cat_name = $GLOBALS['content']['struct'][$cat_id]['acat_name']; | $cat_name = $GLOBALS['content']['struct'][$cat_id]['acat_name']; | ||
| - | $linktext = str_replace('||','',$linktext); // +KH | ||
| $linktext = str_replace('|',((strlen($cat_name) > $max_char_count)? | $linktext = str_replace('|',((strlen($cat_name) > $max_char_count)? | ||
| - | substr($cat_name,0,$max_char_count).$max_char_affix: | + | substr($cat_name,0,$max_char_count).$max_char_affix: |
| - | $cat_name), | + | $cat_name), |
| $linktext); // +KH | $linktext); // +KH | ||
| + | |||
| + | return ($link) ? $link.$linktext.'</a>' : $prefix_no_link.$linktext.$sufix_no_link; | ||
| - | return ($link) ? $link.$linktext.'</a>' : '<'.$class_no_link.' class="xbrowse-unolink">'.$no_linktext.'</'.$class_no_link.'>'; | ||
| } | } | ||
| Line 437: | Line 491: | ||
| - | $content["all"] = preg_replace('/\{XBROWSE:UP:(.*?)\}/e','xget_index_link_up("$1",$up_no_linktext,$up_max_char_count,$up_max_char_affix,$up_class_no_link);',$content["all"]); | + | $content["all"] = preg_replace('/\{XBROWSE:UP:(.*?)\}/e','xget_index_link_up("$1",$up_no_linktext,$up_max_char_count,$up_max_char_affix,$up_prefix_no_link,$up_sufix_no_link);',$content["all"]); |
| $content["all"] = preg_replace('/\{XBROWSE:NEXT:(.*?):(0|1|2)\}/e','xget_index_link_next("$1",$2,$next_no_linktext,$next_max_char_count,$next_max_char_affix,$next_prefix_no_link,$next_sufix_no_link);',$content["all"]); | $content["all"] = preg_replace('/\{XBROWSE:NEXT:(.*?):(0|1|2)\}/e','xget_index_link_next("$1",$2,$next_no_linktext,$next_max_char_count,$next_max_char_affix,$next_prefix_no_link,$next_sufix_no_link);',$content["all"]); | ||
| $content["all"] = preg_replace('/\{XBROWSE:PREV:(.*?):(0|1|2)\}/e','xget_index_link_prev("$1",$2,$prev_no_linktext,$prev_max_char_count,$prev_max_char_affix,$prev_prefix_no_link,$prev_sufix_no_link);',$content["all"]); | $content["all"] = preg_replace('/\{XBROWSE:PREV:(.*?):(0|1|2)\}/e','xget_index_link_prev("$1",$2,$prev_no_linktext,$prev_max_char_count,$prev_max_char_affix,$prev_prefix_no_link,$prev_sufix_no_link);',$content["all"]); | ||