NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms_replacer_rts:frontend_render:article-menu-archive:article-menu-archive-img-template [2009/09/30 07:43] Knut Heermann (flip-flop) |
english:phpwcms_replacer_rts:frontend_render:article-menu-archive:article-menu-archive-img-template [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| - | **RT like the CP Article menu, enhanced to show archived articles too, display articles, skip X leading articles, summary word limit, one image** //(list or detail)//, **random sort order and up to 100 configurable templates. :** | + | **RT like the CP Article menu, enhanced to show archived articles too, No. of displayed articles, skip X leading articles, summary word limit, one image** //(list or detail)//, **random sort order and up to 100 configurable templates. :** |
| * Show archived articles, \\ | * Show archived articles, \\ | ||
| Line 15: | Line 15: | ||
| * random article sort order //(tag)// | * random article sort order //(tag)// | ||
| * output archived articles // (tag)// | * output archived articles // (tag)// | ||
| + | * BBCode in titel and subtitel possible | ||
| \\ | \\ | ||
| Line 22: | Line 23: | ||
| Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, }**## //**(minimal:** The first two parameters must be set **+ ending comma**)// | Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, }**## //**(minimal:** The first two parameters must be set **+ ending comma**)// | ||
| - | Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxC, tXX, rX, wXXX, aX }**## //(if there are more then two parameters, please don´t use an ending comma)// \\ | + | Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxC, tXX, rX, wXXX, aX }**## \\ |
| + | // (if there are more then two parameters, don´t use an ending comma)// \\ | ||
| Line 33: | Line 35: | ||
| + wXXX wordlimit: output of XXX words from summary (-1 = all, 0 = no output), | + wXXX wordlimit: output of XXX words from summary (-1 = all, 0 = no output), | ||
| + aX output archived articles (X = 0 - 6, please have a look in "Parameter set - Sorting the output") | + aX output archived articles (X = 0 - 6, please have a look in "Parameter set - Sorting the output") | ||
| - | [+] = optional | + | |
| + | [#] = required, | ||
| + | [+] = optional | ||
| \\ | \\ | ||
| Line 39: | Line 44: | ||
| **Syntax example:** | **Syntax example:** | ||
| * **{ARTICLE_MENU_ARCHIVE: -1, 0,}** //Actual category, none of the first articles is hidden , display all articles,// | * **{ARTICLE_MENU_ARCHIVE: -1, 0,}** //Actual category, none of the first articles is hidden , display all articles,// | ||
| - | * **{ARTICLE_MENU_ARCHIVE: 23, 5, 2}** //Article in category 23(ID), displays the the first five articles if available, the first two articles are skipped// | + | * **{ARTICLE_MENU_ARCHIVE: 23, 5, s2}** //Article in category 23(ID), displays the the first five articles if available, the first two articles are skipped// |
| - | * **{ARTICLE_MENU_ARCHIVE: 23, 5, 2, 100x80x0x90}** //Article in category 23(ID), displays the the first five articles if available, the first two articles are hidden, article image output 100px x 80px no cropping jpg Quality 90// | + | * **{ARTICLE_MENU_ARCHIVE: 23, 5, s2, 100x80x0x90}** //Article in category 23(ID), displays the the first five articles if available, the first two articles are hidden, article image output 100px x 80px no cropping jpg Quality 90// |
| - | * **{ARTICLE_MENU_ARCHIVE: 23, 5, 0, 50x50x1}** //Article in category 23(ID), displays the the first five articles if available, no articles skipped, article image output 50px x 50px cropped// | + | * **{ARTICLE_MENU_ARCHIVE: 23, 5, s0, 50x50x1}** //Article in category 23(ID), displays the the first five articles if available, no articles skipped, article image output 50px x 50px cropped// |
| - | * **{ARTICLE_MENU_ARCHIVE: 23, 5, 0, 50x50x1, t2}** //The same as before but rendered by using the template No.2 // | + | * **{ARTICLE_MENU_ARCHIVE: 23, 5, s0, 50x50x1, t2}** //The same as before but rendered by using the template No.2 // |
| * **{ARTICLE_MENU_ARCHIVE: 23, 5, s0, 50x50x1, t21, r1, w25, a3}** | * **{ARTICLE_MENU_ARCHIVE: 23, 5, s0, 50x50x1, t21, r1, w25, a3}** | ||
| Line 82: | Line 87: | ||
| Update: 05.09.09 KH: + counter for "How many articles are to be shown" (0 = all) | Update: 05.09.09 KH: + counter for "How many articles are to be shown" (0 = all) | ||
| Update: 16.08.09 KH: + counter for "How many of the first articles are to be hidden" (0 = nothing hidden) | Update: 16.08.09 KH: + counter for "How many of the first articles are to be hidden" (0 = nothing hidden) | ||
| + | Update: 10.12.09 KH: + BBCode in titel and subtitel possible | ||
| </code> | </code> | ||
| Line 88: | Line 94: | ||
| Based on the cp article menu. | Based on the cp article menu. | ||
| - | Tag: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article, count-hide, WxHxCxQ, tXX, rX, wXXX, aX}** \\ | + | Tag: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxCxQ, tXX, rX, wXXX, aX}** \\ |
| - | or **{ARTICLE_MENU_ARCHIVE: -1, count-article, count-hide}** //for the actual category// \\ | + | or **{ARTICLE_MENU_ARCHIVE: -1, count-article, sXX}** //for the actual category// \\ |
| Minimally set: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article,}** //(end with a comma !!)// | Minimally set: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article,}** //(end with a comma !!)// | ||
| Line 112: | Line 118: | ||
| ==== Parameter set ==== | ==== Parameter set ==== | ||
| + | with default values for some tagged parameters | ||
| <file> | <file> | ||
| // Sorting the output: all|archived|not archived | // Sorting the output: all|archived|not archived | ||
| Line 126: | Line 132: | ||
| // Insert one of the previous number | // Insert one of the previous number | ||
| - | $article_archive_status = 2; // E.g. Show entries with activated archive status? | + | $alinkmenu['article_archive_status_set'] = 2; // E.g. Show entries with activated archive status? |
| // ------------------------------------------ | // ------------------------------------------ | ||
| // Image parameters: list|detail ------------ | // Image parameters: list|detail ------------ | ||
| - | $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image | + | $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image |
| - | // 3 = list image + link | 4 = detail image + link | + | // 3 = list image + link | 4 = detail image + link |
| // Content part parameters ------------------ | // Content part parameters ------------------ | ||
| - | $alinkmenu['subtitle_on'] = 1; // Article sub title text output [0|1] | ||
| - | $alinkmenu['headertext'] = 1; // summary text [0|1] | ||
| - | $alinkmenu['ul'] = 3; // 1: render as unordered list / 2: render as div / 3: render template / 4: render as table | ||
| - | $alinkmenu['class'] = ''; // wrapped class | ||
| - | $alinkmenu['more'] = ' »'; // more link text | ||
| - | $alinkmenu['moretextsum'] = ' …'; // more text in summary | ||
| - | $alinkmenu['hideactive'] = 0; // hide active article in article menu [0 = no article hide] | ||
| - | $alinkmenu['wordlimit'] = 5; // maxwords summary [0-999 / 0 = no words / -1 = all words] | + | $alinkmenu['subtitle_on'] = 1; // Article sub title text output [0|1] |
| - | $alinkmenu['allowedtags'] = '<b><i><u><s><strong>'; // allowed tags in summary | + | $alinkmenu['headertext'] = 1; // summary text [0|1] |
| + | $alinkmenu['ul'] = 3; // 1: render as unordered list / 2: render as div / | ||
| + | // 3: render template / 4: render as table | ||
| + | $alinkmenu['class'] = ''; // wrapped class | ||
| + | $alinkmenu['more'] = ' &raquo;'; // more link text | ||
| + | $alinkmenu['moretextsum'] = ' &hellip;'; // more text in summary | ||
| + | $alinkmenu['hideactive'] = 0; // hide active article in article menu [0 = no article hide] | ||
| - | $alinkmenu['random'] = 0; // random sort order for article [0|1] | + | $alinkmenu['wordlimit'] = 5; // maxwords summary [0-999 / 0 = no words / -1 = all words] |
| + | $alinkmenu['allowedtags'] = '<b><i><u><s><strong>'; // allowed tags in summary | ||
| + | |||
| + | $alinkmenu['leading_article_hide'] = 0; // No Artikle skipped | ||
| + | $alinkmenu['WxHxCxQ'] = ''; // No image parameter set e.g. set 100x80x0 | ||
| + | $alinkmenu['template_no'] = 0; // default template = 0 | ||
| + | |||
| + | $alinkmenu['random'] = 0; // random sort order for article [0|1] | ||
| + | |||
| </file> | </file> | ||
| Line 164: | Line 177: | ||
| Section: **TEMPLATES** for ($alinkmenu['ul'] = 3 --------------------------------------- \\ | Section: **TEMPLATES** for ($alinkmenu['ul'] = 3 --------------------------------------- \\ | ||
| - | A very simple templates //(Up to 10 different templates possible)// | + | A very simple templates //(Up to 100 different templates possible)// |
| **Tags** //(place holder)//: | **Tags** //(place holder)//: | ||
| Line 276: | Line 289: | ||
| 16.08.09 KH Update: + counter for "How many of the first articles are to be hidden" | 16.08.09 KH Update: + counter for "How many of the first articles are to be hidden" | ||
| {ARTICLE_MENU_ARCHIVE:category-ID, count-hide} | {ARTICLE_MENU_ARCHIVE:category-ID, count-hide} | ||
| - | E.g.:{ARTICLE_MENU_ARCHIVE:-1,0} (Both parameters must be set) | + | E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,} (Both parameters must be set) |
| 05.09.09 KH Update: + count_article for "How many of articles are to be shown" (if available) | 05.09.09 KH Update: + count_article for "How many of articles are to be shown" (if available) | ||
| Line 314: | Line 327: | ||
| + output archived articles in tag | + output archived articles in tag | ||
| - | E.g.:{ARTICLE_MENU_ARCHIVE:18,8,s0 ,50x50x1,t21, r1, w25, a3 } | + | E.g.:{ARTICLE_MENU_ARCHIVE:18, 8, s0 ,50x50x1, t21, r1, w25, a3 } |
| category-ID=18, show the first eight articles, | category-ID=18, show the first eight articles, | ||
| no articles skipped, | no articles skipped, | ||
| Line 322: | Line 335: | ||
| wordlimit = 25, | wordlimit = 25, | ||
| output archived articles (article_begin > NOW AND article_end > NOW) | output archived articles (article_begin > NOW AND article_end > NOW) | ||
| + | |||
| + | 10.12.09 KH Update: + BBCode in titel and subtitel possible | ||
| + | E.g.: [i]Title[/i] [b]Subtitle[/b] ...... | ||
| V1.4 | V1.4 | ||
| *************************************************************************************/ | *************************************************************************************/ | ||
| - | + | ||
| - | + | //article menu enhanced | |
| - | // ---------------------------------------------------------------- | + | |
| - | // obligate check for phpwcms constants | + | // {ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxC, tXX, rX, wXXX, aX } |
| - | if (!defined('PHPWCMS_ROOT')) { | + | |
| - | die("You Cannot Access This Script Directly, Have a Nice Day."); } | + | |
| - | // ---------------------------------------------------------------- | + | |
| - | + | ||
| - | + | ||
| - | //article menu enhanced | + | |
| // $catid: the category ID where the articles are (-1 = current category)) | // $catid: the category ID where the articles are (-1 = current category)) | ||
| // sXX-paramter: $leading_article_hide: How many of the first articles are to be skipped | // sXX-paramter: $leading_article_hide: How many of the first articles are to be skipped | ||
| Line 342: | Line 353: | ||
| // rX -parameter: [0|1] random article sort order | // rX -parameter: [0|1] random article sort order | ||
| // wXXX-parameter: No. 0-999 max. words: [-1]=all words, [0]= no words | // wXXX-parameter: No. 0-999 max. words: [-1]=all words, [0]= no words | ||
| + | |||
| + | |||
| + | |||
| + | // ---------------------------------------------------------------- | ||
| + | // obligate check for phpwcms constants | ||
| + | if (!defined('PHPWCMS_ROOT')) { | ||
| + | die("You Cannot Access This Script Directly, Have a Nice Day."); } | ||
| + | // ---------------------------------------------------------------- | ||
| + | |||
| function my_article_menu_archive ($catid = 0, $count_article, $article_skip_WxHxCxQ_template = '', $CNT_TMP = '') { | function my_article_menu_archive ($catid = 0, $count_article, $article_skip_WxHxCxQ_template = '', $CNT_TMP = '') { | ||
| Line 441: | Line 461: | ||
| // Insert one of the previous number | // Insert one of the previous number | ||
| - | $article_archive_status = 2; // E.g. Show entries with activated archive status? | + | $alinkmenu['article_archive_status_set'] = 2; // E.g. Show entries with activated archive status? |
| // ------------------------------------------ | // ------------------------------------------ | ||
| // Image parameters: list|detail ------------ | // Image parameters: list|detail ------------ | ||
| - | $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image | + | $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image |
| - | // 3 = list image + link | 4 = detail image + link | + | // 3 = list image + link | 4 = detail image + link |
| // Content part parameters ------------------ | // Content part parameters ------------------ | ||
| - | $alinkmenu['subtitle_on'] = 1; // Article sub title text output [0|1] | + | $alinkmenu['subtitle_on'] = 1; // Article sub title text output [0|1] |
| - | $alinkmenu['headertext'] = 1; // summary text [0|1] | + | $alinkmenu['headertext'] = 1; // summary text [0|1] |
| - | $alinkmenu['ul'] = 3; // 1: render as unordered list / 2: render as div / 3: render template / 4: render as table | + | $alinkmenu['ul'] = 3; // 1: render as unordered list / 2: render as div / |
| - | $alinkmenu['class'] = ''; // wrapped class | + | // 3: render template / 4: render as table |
| - | $alinkmenu['more'] = ' »'; // more link text | + | $alinkmenu['class'] = ''; // wrapped class |
| - | $alinkmenu['moretextsum'] = ' …'; // more text in summary | + | $alinkmenu['more'] = ' »'; // more link text |
| - | $alinkmenu['hideactive'] = 0; // hide active article in article menu [0 = no article hide] | + | $alinkmenu['moretextsum'] = ' …'; // more text in summary |
| + | $alinkmenu['hideactive'] = 0; // hide active article in article menu [0 = no article hide] | ||
| - | $alinkmenu['wordlimit'] = 5; // maxwords summary [0-999 / 0 = no words / -1 = all words] | + | $alinkmenu['wordlimit'] = 5; // maxwords summary [0-999 / 0 = no words / -1 = all words] |
| - | $alinkmenu['allowedtags'] = '<b><i><u><s><strong>'; // allowed tags in summary | + | $alinkmenu['allowedtags'] = '<b><i><u><s><strong>'; // allowed tags in summary |
| - | $alinkmenu['random'] = 0; // random sort order for article [0|1] | + | $alinkmenu['leading_article_hide'] = 0; // No Artikle skiped |
| + | $alinkmenu['WxHxCxQ'] = ''; // No image parameter set e.g. set 100x80x0 | ||
| + | $alinkmenu['template_no'] = 0; // default template = 0 | ||
| + | |||
| + | $alinkmenu['random'] = 0; // random sort order for article [0|1] | ||
| /* Sorting order for "second entry" | /* Sorting order for "second entry" | ||
| Line 544: | Line 569: | ||
| // catch parameters from TAG ------------------------------ | // catch parameters from TAG ------------------------------ | ||
| - | $leading_article_hide = 0; // No Artikle skiped | ||
| - | $WxHxCxQ = ''; // No image parameter set | ||
| - | $template_no = 0; // default template = 0 | ||
| - | + | // $alinkmenu['article_archive_status_set'] = 2; // E.g. Show entries with activated archive status? | |
| - | + | ||
| - | //$alinkmenu['wordlimit'] = 5; // maxwords summary | + | |
| - | //$alinkmenu['random'] = 0; // random sort order for article [0|1] | + | // $alinkmenu['wordlimit'] = 5; // maxwords summary |
| + | // $alinkmenu['leading_article_hide'] = 0; // No Artikle skiped | ||
| + | // $alinkmenu['WxHxCxQ'] = ''; // No image parameter set e.g. set 100x80x0 | ||
| + | // $alinkmenu['template_no'] = 0; // default template = 0 | ||
| + | |||
| + | // $alinkmenu['random'] = 0; // random sort order for article [0|1] | ||
| + | // --------------------------------------------------------- | ||
| - | |||
| - | // E.g. {ARTICLE_MENU_ARCHIVE:18,8,0,50x50x1,t2,r1,w10} | + | // E.g. {ARTICLE_MENU_ARCHIVE:18,8,0,50x50x1,t2,r1,w10,a3} |
| if ( !empty($article_skip_WxHxCxQ_template) ) { | if ( !empty($article_skip_WxHxCxQ_template) ) { | ||
| Line 575: | Line 600: | ||
| if ( preg_match('/[0-9]{1,3}x[0-9]{1,3}x[0|1]{1}/', $value) ) { // WxHxCxQ image parameter | if ( preg_match('/[0-9]{1,3}x[0-9]{1,3}x[0|1]{1}/', $value) ) { // WxHxCxQ image parameter | ||
| - | $WxHxCxQ = $value; | + | $alinkmenu['WxHxCxQ'] = $value; |
| } | } | ||
| elseif ( preg_match('/s{1}[0-9]{1,2}/', $value, $alinkmenu['temp1']) ) { // "sXX" skip article | elseif ( preg_match('/s{1}[0-9]{1,2}/', $value, $alinkmenu['temp1']) ) { // "sXX" skip article | ||
| - | $leading_article_hide = (int)substr($alinkmenu['temp1']['0'],1,2); | + | $alinkmenu['leading_article_hide'] = (int)substr($alinkmenu['temp1']['0'],1,2); |
| } | } | ||
| elseif ( preg_match('/t{1}[0-9]{1,2}/', $value, $alinkmenu['temp1']) ) { // "tXX" for template selection | elseif ( preg_match('/t{1}[0-9]{1,2}/', $value, $alinkmenu['temp1']) ) { // "tXX" for template selection | ||
| - | $template_no = (int)substr($alinkmenu['temp1']['0'],1,2); | + | $alinkmenu['template_no'] = (int)substr($alinkmenu['temp1']['0'],1,2); |
| - | if ( count($alinkmenu['template']) < $template_no ) $template_no = 0; | + | if ( count($alinkmenu['template']) < $alinkmenu['template_no'] ) $alinkmenu['template_no'] = 0; |
| } | } | ||
| elseif ( preg_match('/r{1}[0|1]{1}/', $value, $alinkmenu['temp1']) ) { // "rX" for random sort order | elseif ( preg_match('/r{1}[0|1]{1}/', $value, $alinkmenu['temp1']) ) { // "rX" for random sort order | ||
| Line 594: | Line 619: | ||
| } | } | ||
| elseif ( preg_match('/a{1}[0-6]{1,1}/', $value, $alinkmenu['temp1']) ) { // "aX" archived articles? | elseif ( preg_match('/a{1}[0-6]{1,1}/', $value, $alinkmenu['temp1']) ) { // "aX" archived articles? | ||
| - | $article_archive_status = (int)substr($alinkmenu['temp1']['0'],1,1); | + | $alinkmenu['article_archive_status_set'] = (int)substr($alinkmenu['temp1']['0'],1,1); |
| } | } | ||
| } | } | ||
| Line 601: | Line 626: | ||
| // Image parameter available? | // Image parameter available? | ||
| - | if ( empty($WxHxCxQ ) ) $alinkmenu['is_image'] = 0 ; | + | if ( empty($alinkmenu['WxHxCxQ'] ) ) $alinkmenu['is_image'] = 0 ; |
| // END Parameters from TAG -------------------------- | // END Parameters from TAG -------------------------- | ||
| Line 611: | Line 636: | ||
| - | switch($article_archive_status) { | + | switch($alinkmenu['article_archive_status_set']) { |
| case 0: // article_archive_status ist not set | case 0: // article_archive_status ist not set | ||
| $alinkmenu['article_archive_status'] = ' '; | $alinkmenu['article_archive_status'] = ' '; | ||
| Line 660: | Line 685: | ||
| - | if(isset($result[$leading_article_hide]['article_id'])) { | + | if(isset($result[$alinkmenu['leading_article_hide']]['article_id'])) { |
| $count = 0; | $count = 0; | ||
| Line 671: | Line 696: | ||
| foreach($result as $value) { | foreach($result as $value) { | ||
| - | if( $count >= $leading_article_hide ) { // Hide first articles? | + | if( $count >= $alinkmenu['leading_article_hide'] ) { // Hide first articles? |
| if( $count_article > $count_art ) { // Max article shown | if( $count_article > $count_art ) { // Max article shown | ||
| Line 752: | Line 777: | ||
| - | $alinkmenu['imageonly'] = '<img src="img/cmsimage.php/'.$WxHxCxQ.'/'; | + | $alinkmenu['imageonly'] = '<img src="img/cmsimage.php/'.$alinkmenu['WxHxCxQ'].'/'; |
| $alinkmenu['imageonly'] .= $alinkmenu['image_array'][$temp.'hash'].'.'.$alinkmenu['image_array'][$temp.'ext'].'"'; | $alinkmenu['imageonly'] .= $alinkmenu['image_array'][$temp.'hash'].'.'.$alinkmenu['image_array'][$temp.'ext'].'"'; | ||
| $alinkmenu['imageonly'] .= ' alt="'.$alinkmenu['image_array'][$temp.'name'].'" />'; | $alinkmenu['imageonly'] .= ' alt="'.$alinkmenu['image_array'][$temp.'name'].'" />'; | ||
| Line 774: | Line 799: | ||
| // ArticleTitle ------------------ | // ArticleTitle ------------------ | ||
| - | $alinkmenu['title'] = html_specialchars($value['article_title']); | + | $alinkmenu['title'] = render_bbcode_basics(html_specialchars($value['article_title'])); |
| // SubTitle ---------------------- | // SubTitle ---------------------- | ||
| $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ? | $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ? | ||
| - | html_specialchars($value['article_subtitle']) : ''; | + | render_bbcode_basics(html_specialchars($value['article_subtitle'])) : ''; |
| Line 844: | Line 869: | ||
| case 3: // render with template | case 3: // render with template | ||
| - | $alinkmenu['temp'] = $alinkmenu['template'][$template_no]; | + | $alinkmenu['temp'] = $alinkmenu['template'][$alinkmenu['template_no']]; |
| $alinkmenu['temp'] = str_replace('[LINK]' , $alinkmenu['link_wrap'] , $alinkmenu['temp']); | $alinkmenu['temp'] = str_replace('[LINK]' , $alinkmenu['link_wrap'] , $alinkmenu['temp']); | ||