{{indexmenu_n>20}} ====== Article menu (count/arch/img/templ) ====== **RT like the CP Article menu, enhanced to show archived articles too, display articles, skip articles, word limit, one image and 10 configurable templates:** * Show archived articles, \\ * number of articles which can be displayed \\ * number of skipped articles \\ * and one image //(list or detail)// from article configured by **WxHxCxQ** \\ * word limit with html rendering and allowed tags \\ * 0-9 simple different templates using place holder \\ \\ **rt_article_menu_archive** V1.3 27.09.09 Update: 16.08.09 KH: + counter for "How many of the first articles are to be hidden" (0 = nothing hidden) Update: 05.09.09 KH: + counter for "How many articles are to be shown" (0 = all) Update: 25.09.09 KH: + thumb image from article list- or detail (if available) (WxHxCxQ) Update: 26.09.09 KH: + rendering html, allowed tags, maxchar count changed to maxword (the same like tease) Update: 27.09.09 KH: + 10 configurable templates \\ Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, }**## // (The first two parameters must be set + comma) // \\ Syntax: ##**{ARTICLE_MENU_ARCHIVE: category-ID, count-article, count-hide, WxHxC, tX }**## \\ // (Cat-ID, articles max.-count, articles skipped, article image, t0=template No 0, t1=template No 1, t3= ....) // **Syntax example:** * **{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, 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, 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, 0, 50x50x1, t2}** //The same as before but rendered by using the template No.2 // The image parameter set (WxHxCxQ): %WIDTH%x%HEIGHT%x%CROP%x%QUALITY% by default this should be enough: %WIDTH%x%HEIGHTx%CROP% \\ Docu: -- \\ Forum: -- **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS version:** >= 1.4 \\ **Version:** V1.3 \\ Based on the cp article menu. Tag: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article, count-hide, WxHxCxQ, tX}** \\ or **{ARTICLE_MENU_ARCHIVE: -1, count-article, count-hide}** //for the actual category// \\ Minimally set: **{ARTICLE_MENU_ARCHIVE: category-ID, count-article,}** //(end with a comma !!)// Filename: **rt_article_menu_archive.php** Location: ** template/inc_script/frontend_render/ ** **Condition:** -> [[http://www.phpwcms-docu.de/conf_inc_php_en.phtml|/config/phpwcms/conf.inc.php]] \\ * ##$phpwcms['allow_ext_render'] = 1;## ---- ---- \\ ===== Inner parameters ===== ==== Parameter set ==== // Sorting the output: all|archived|not archived // ------------------------------------------ // 0: all articles // 1: archive_status=1 AND article_beginNOW() // 3: archive_status=1 AND article_begin>NOW() AND article_end>NOW() // 4: archive_status=0 AND article_beginNOW() // 6: archive_status=0 AND article_begin>NOW() AND article_end>NOW() // Insert one of the previous number $article_archive_status = 2; // E.g. Show entries with activated archive status? // ------------------------------------------ // Image parameters: list|detail ------------ $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image // 3 = list image + link | 4 = detail image + link // 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 $alinkmenu['wordlimit'] = 5; // maxwords summary $alinkmenu['allowedtags'] = ''; // allowed tags in summary \\ ==== Layout and image ==== Section: **Image parameters --------------------** //Images from article head: off|list[+link]|detail[+link] // $alinkmenu['is_image'] = 4; // 0 = off | 1 = list image | 2 = detail image // 3 = list image + link | 4 = detail image + link \\ Section: **TEMPLATES** for ($alinkmenu['ul'] = 3 --------------------------------------- \\ A very simple templates //(Up to 10 different templates possible)// **Tags** //(place holder)//: [LINK].....[/LINK] (the link, all between is the link text) {THUMBNAIL} (the article list- or detail image formatted like WxHxC) {TITLE} (title from the article) {SUBTITLE} (sub title from article) {SUMMARY} (the summary of the article) // Wrapper around all entries: begin, end $alinkmenu['wrap_template'] = array('
','
'); // Template No: 0 (default) ----------------- $alinkmenu['template'][0] = '
[LINK]{THUMBNAIL}[/LINK]
[LINK]{TITLE}{MORE}[/LINK]
{SUBTITLE}
{SUMMARY}
'; // Template No: 1 --------------------------- $alinkmenu['template'][1] = '
[LINK]{THUMBNAIL}[/LINK]
[LINK]{TITLE}{MORE}[/LINK]
{SUBTITLE}
{SUMMARY}
';
Please generate your own template between ##$alinkmenu['template'][**X**] = '. . . . .';## \\ where **X** is the template No. \\ E.g. **generated source from template No: 0:**
InmageName.jpg
Article-sub-title
The summary text for testing »
... ...
\\ ===== Code v1.3 ===== '; echo ' ERROR: Wrong integer parameter in {ARTICLE_MENU_ARCHIVE:...
'; echo '============================================
'; return false; } global $aktion; // User defination ============================================================ // =============== Simulated CP paramter ====================================== // TEMPLATES for ($alinkmenu['ul'] = 3 --------------------------------------- // Wrapper around all entries: begin, end $alinkmenu['wrap_template'] = array('
','
'); // Template No: 0 (default) ----------------- $alinkmenu['template'][0] = '
[LINK]{THUMBNAIL}[/LINK]
[LINK]{TITLE}{MORE}[/LINK]
{SUBTITLE}
{SUMMARY}
'; // Template No: 1 --------------------------- $alinkmenu['template'][1] = '
[LINK]{THUMBNAIL}[/LINK]
[LINK]{TITLE}{MORE}[/LINK]
{SUBTITLE}
{SUMMARY}
'; // Template No: 2 -------------------------- $alinkmenu['template'][2] = '
[LINK]{THUMBNAIL}[/LINK]
[LINK]{TITLE}{MORE}[/LINK]
{SUBTITLE}
{SUMMARY}
'; // Template No: 3 -------------------------- //$alinkmenu['template'][3] = ' //
//..... //
'; // END TEMPLATES - ----------------------------------------------------------- // ContentPart head ------------------------- // Insert title/subtitle name and css for the virtual content part $virt_article_title = ''; //

MyTitle

$virt_article_subtitle = ''; //

MySubTitle

// ------------------------------------------ // Parameter set ---------------------------- // Sorting the output: all|archived|not archived // ------------------------------------------ // 0: all articles // 1: archive_status=1 AND article_beginNOW() // 3: archive_status=1 AND article_begin>NOW() AND article_end>NOW() // 4: archive_status=0 AND article_beginNOW() // 6: archive_status=0 AND article_begin>NOW() AND article_end>NOW() // Insert one of the previous number $article_archive_status = 2; // E.g. Show entries with activated archive status? // ------------------------------------------ // Image parameters: list|detail ------------ $alinkmenu['is_image'] = 3; // 0 = off | 1 = list image | 2 = detail image // 3 = list image + link | 4 = detail image + link // 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 $alinkmenu['wordlimit'] = 5; // maxwords summary $alinkmenu['allowedtags'] = ''; // allowed tags in summary /* Sorting order for "second entry" --------------------------------------------- $ao[2] = ' article_sort ASC'; $ao[2] = ' article_sort DESC'; $ao[2] = ' article_created ASC'; $ao[2] = ' article_created DESC'; $ao[2] = ' article_tstamp ASC'; $ao[2] = ' article_tstamp DESC'; $ao[2] = ' article_begin ASC'; $ao[2] = ' article_begin DESC'; $ao[2] = ' article_title ASC'; $ao[2] = ' article_title DESC'; $ao[2] = ' article_end ASC'; $ao[2] = ' article_end DESC'; $ao[2] = ' article_priorize DESC,'.$ao[2]; -------------------------------------------- */ // Sorting order ---------------------------- $ao['2'] = ' article_priorize DESC,'; // Don´t change!!! $ao['2'] .= ' article_sort ASC'; // second entry // END user defination ======================================================== // ============================================================================ // CSS classes for
    and
    rendering ----------------------------------- // A very simple template (Please have a look for the {IMAGE} tag) $alinkmenu['wrap_all'] = array('
    ','
    '); // Wrap around all $alinkmenu['wrap_data'] = array('{IMAGE}
    ','
    '); // Data wrap begin, end $alinkmenu['wrap_title'] = array('
    ','
    '); // Title wrap around all begin, end $alinkmenu['wrap_subtitle'] = array('
    ','
    '); // SubTitle wrap begin, end $alinkmenu['wrap_summary'] = array('
    ','
    '); // Wrap around summary begin, end $alinkmenu['class_active_link'] = 'active_link'; // Active link class $alinkmenu["style_before"] = '
    '; // Format before every data set. $alinkmenu["style_behind"] = '
    '; // Format behind every data set. /* Example: $alinkmenu['wrap_all'] = array('
    ','
    '); // Wrap around all $alinkmenu['wrap_data'] = array('',''); // Data wrap begin, end $alinkmenu['wrap_title'] = array('
    ','
    '); // Title wrap around all begin, end $alinkmenu['wrap_subtitle'] = array('

    ','

    '); // SubTitle wrap begin, end $alinkmenu['wrap_summary'] = array('',''); // Wrap around summary begin, end $alinkmenu['class_active_link'] = 'active_link'; // Active link class $alinkmenu["style_before"] = ''; // Format before every data set. // Format behind every data set. $alinkmenu["style_behind"] = '
    '; */ // Image control if there is an empty or bad string -------------------------- // valid image parameter like WxHxCxQ ? $alinkmenu['tag_image'] = '{IMAGE}'; // place holder for the image, it must be the same you insert into CSS classes for
      and
      rendering"!! // Set the {IMAGE} place holder where you want as shown above in "CSS classes". // -------------------------------------- // A container //
      // is autom. generated around the image if there is one available //
      // -------------------------------------- // ---------------------------------------------------------------------------- // catch parameters from TAG ------------------------------ $leading_article_hide = 0; // No Artikle skiped $WxHxCxQ = ''; // No image parameter set $template_no = 0; if ( !empty($article_skip_WxHxCxQ_template) ) { $alinkmenu['temp'] = explode (",",strtolower(trim($article_skip_WxHxCxQ_template))); // === $alinkmenu['temp'][0] => first article skip // === $alinkmenu['temp'][1] => WxHxCxQ // === $alinkmenu['temp'][2] => template_No if ( count($alinkmenu['temp']) ) { foreach ($alinkmenu['temp'] as $value) { preg_replace('/[^0-9xt]/', '', $value); // WxHxCxQ and integer and t if ( preg_match('/[0-9]{1,3}x[0-9]{1,3}x[0|1]{1}/', $value) ) { // WxHxCxQ image parameter $WxHxCxQ = $value; } elseif ( preg_match('/t{1}[0-9]{1}/', $value, $alinkmenu['temp1']) ) { // "tX" for template selection $template_no = (int)substr($alinkmenu['temp1']['0'],1,1); if ( count($alinkmenu['template']) < $template_no ) $template_no = 0; } elseif (is_intval($value)) { // skip article $leading_article_hide = $value; } } } } // Image parameter available? if ( empty($WxHxCxQ ) ) $alinkmenu['is_image'] = 0 ; // END Parameters from TAG -------------------------- // catid = -1: The current category is selected $alinkmenu["catid"] = ($catid < 0) ? $GLOBALS['content']['cat_id'] : $catid; // Article category-ID $alinkmenu['link'] = ''; // reserved, don´t change!!! switch($article_archive_status) { case 0: // article_archive_status ist not set $alinkmenu['article_archive_status'] = ' '; break; case 1: $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin All articles output ) ($count_article <= 0) ? $count_art == -1000 : $count_art = 0; foreach($result as $value) { if( $count >= $leading_article_hide ) { // Hide first articles? if( $count_article > $count_art ) { // Max article shown $tempRowSpan = ''; $value['article_summary'] = preg_replace('/]*?>$/i', '', $value['article_summary']); // article_summary // Summary ---------------------- if($alinkmenu['headertext'] && !empty($value['article_summary'])) { $alinkmenu['sum'] = $value['article_summary']; // Clean the text ------ if(!empty($alinkmenu['wordlimit'])) { $alinkmenu['sum'] = empty($alinkmenu['allowedtags']) ? strip_tags($alinkmenu['sum']) : strip_tags($alinkmenu['sum'], $alinkmenu['allowedtags']); if(!empty($alinkmenu['wordlimit'])) { $alinkmenu['sum'] = getCleanSubString($alinkmenu['sum'], $alinkmenu['wordlimit'], $alinkmenu['moretextsum'], 'word'); } } } else { $alinkmenu['sum'] = false; } // END Summary ------------------ // Image ------------------------- // $alinkmenu[image_array] => Array // ( // [tmpllist] => default // [tmplfull] => default // [name] => dscn0702_2048x1536.jpg // [id] => 16 // [width] => 200 // [height] => 200 // [caption] => Wiese // [zoom] => 0 // [lightbox] => 0 // [hash] => 3496e044e78343317f378925eb13bfd9 // [ext] => jpg // [list_usesummary] => 0 // [list_name] => cimg1435_2048x1536.jpg // [list_id] => 15 // [list_width] => 100 // [list_height] => 100 // [list_caption] => Tanke // [list_zoom] => 0 // [list_lightbox] => 0 // [list_maxwords] => 0 // [list_hash] => b06c6301cfa9c5d233f74c94fc22bb94 // [list_ext] => jpg // ) // mein Bild // ======= cmsimage parameter set // get segments: cmsimage.php/%WIDTH%x%HEIGHT%x%CROP%x%QUALITY%/%HASH%.%EXT% // by default this should be enough: cmsimage.php/%WIDTH%x%HEIGHT/%HASH%.%EXT% // 0 = off | 1 = list image | 2 = detail image | 3 = list image + link | 4 = detail image + link if ($alinkmenu['is_image']) { // Only if image flag is set $alinkmenu['image_array'] = unserialize( $value['article_image'] ); ( $alinkmenu['is_image'] == 2 // Is detail image set? OR $alinkmenu['is_image'] == 4 OR $alinkmenu['image_array']['list_usesummary'] == 1) ? $temp = '' : $temp = 'list_'; if (!empty($alinkmenu['image_array'][$temp.'hash'])) { $alinkmenu['image'] = LF.'
      '; if ($alinkmenu['is_image'] > 2) // image with link $alinkmenu['image'] .= ''; $alinkmenu['imageonly'] = ''; $alinkmenu['image'] .= $alinkmenu['imageonly']; if ($alinkmenu['is_image'] > 2) // image with link $alinkmenu['image'] .= ''; $alinkmenu['image'] .= '
      '.LF; } else { $alinkmenu['image'] = ''; $alinkmenu['imageonly'] = ''; } } // END Image --------------------- // ArticleTitle ------------------ $alinkmenu['title'] = html_specialchars($value['article_title']); // SubTitle ---------------------- $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ? html_specialchars($value['article_subtitle']) : ''; // set link or link with active link class -------------------- $alinkmenu['link_wrap'] = ''; if (empty($alinkmenu['hideactive']) AND ($value['article_id'] == $aktion[1])) { $alinkmenu['link_wrap'] = ''; } switch($alinkmenu['ul']) { case 1: // render as unordered list $alinkmenu['link'] .= LF.$alinkmenu["style_before"].LF; $alinkmenu['link'] .= '
    • '.LF; $alinkmenu['link'] .= $alinkmenu['wrap_data'][0].LF.$alinkmenu['wrap_title'][0].LF; $alinkmenu['link'] .= $alinkmenu['link_wrap']; $alinkmenu['link'] .= $alinkmenu['title']; $alinkmenu['link'] .= $alinkmenu['more'].''.$alinkmenu['wrap_title'][1].LF; // SubTitle ---------------------- if (!empty($alinkmenu['subtitle'])) $alinkmenu['link'] .= "\n".$alinkmenu['wrap_subtitle'][0].$alinkmenu['subtitle'].$alinkmenu['wrap_subtitle'][1]; // Summary - --------------------- if($alinkmenu['sum'] !== false) $alinkmenu['link'] .= "\n".$alinkmenu['wrap_summary'][0].LF.$alinkmenu['sum'].LF.$alinkmenu['wrap_summary'][1]; $alinkmenu['link'] .= $alinkmenu['wrap_data'][1]."
    • \n"; $alinkmenu['link'] .= LF.$alinkmenu["style_behind"].LF; break; case 2: // render as div $alinkmenu['link'] .= LF.$alinkmenu["style_before"].LF; $alinkmenu['link'] .= '
      '.LF; $alinkmenu['link'] .= $alinkmenu['wrap_data'][0].LF.$alinkmenu['wrap_title'][0].LF; $alinkmenu['link'] .= $alinkmenu['link_wrap']; $alinkmenu['link'] .= $alinkmenu['title']; $alinkmenu['link'] .= $alinkmenu['more'].''.$alinkmenu['wrap_title'][1].LF; // SubTitle ---------------------- if (!empty($alinkmenu['subtitle'])) $alinkmenu['link'] .= "\n".$alinkmenu['wrap_subtitle'][0].$alinkmenu['subtitle'].$alinkmenu['wrap_subtitle'][1]; // Summary - --------------------- if($alinkmenu['sum'] !== false) { $alinkmenu['link'] .= "\n".$alinkmenu['wrap_summary'][0].LF.$alinkmenu['sum'].LF.$alinkmenu['wrap_summary'][1]; } $alinkmenu['link'] .= $alinkmenu['wrap_data'][1]."
      \n"; $alinkmenu['link'] .= LF.$alinkmenu["style_behind"].LF; break; case 3: // render with template $alinkmenu['temp'] = $alinkmenu['template'][$template_no]; $alinkmenu['temp'] = str_replace('[LINK]' , $alinkmenu['link_wrap'] , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('[/LINK]' , '' , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('{TITLE}' , $alinkmenu['title'] , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('{SUBTITLE}' , $alinkmenu['subtitle'] , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('{MORE}' , $alinkmenu['more'] , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('{THUMBNAIL}', $alinkmenu['imageonly'] , $alinkmenu['temp']); $alinkmenu['temp'] = str_replace('{SUMMARY}' , $alinkmenu['sum'] , $alinkmenu['temp']); $alinkmenu['link'] .= $alinkmenu['temp']; $alinkmenu['temp'] = ''; break; default: // render as table // SubTitle ------------ if (!empty($alinkmenu['subtitle'])) { $tempRowSpan = ' rowspan="2"'; $alinkmenu['subtitle'] = "\n\t" .$alinkmenu['wrap_subtitle'][0].$alinkmenu['subtitle'].$alinkmenu['wrap_subtitle'][1]. "\n\n"; } // Summary - --------------------- if($alinkmenu['sum'] !== false) { $tempRowSpan = ' rowspan="3"'; $alinkmenu['sum'] = "\n\t" .$alinkmenu['wrap_summary'][0].LF.$alinkmenu['sum'].LF.$alinkmenu['wrap_summary'][1] . "\n\n"; } $alinkmenu['link'] .= "\n\t".$GLOBALS["template_default"]["article"]["link_article_sign"]."\n\t"; $alinkmenu['link'] .= ''.$alinkmenu['wrap_title'][0].$alinkmenu['link_wrap']; $alinkmenu['link'] .= $alinkmenu['title'].$alinkmenu['more'].''.$alinkmenu['wrap_title'][1]."\n\n"; $alinkmenu['link'] .= $alinkmenu['subtitle']; $alinkmenu['link'] .= $alinkmenu['sum']; } // Image tag available, only for
        and
        renderering? if (!empty($alinkmenu['tag_image'])) { $alinkmenu['link'] = str_replace($alinkmenu['tag_image'], $alinkmenu['image'], $alinkmenu['link']); } } // END if $count_art .... $count_art++; } // END if $count .... $count++; } // END foreach // mysql_free_result($result); } if($alinkmenu['link']) { switch($alinkmenu['ul']) { case 1: // render as unordered list $alinkmenu['link'] = "
          \n" . $alinkmenu['link'] . "
        \n"; break; case 2: // render as div break; case 3: // free template $alinkmenu['link'] = $alinkmenu['wrap_template']['0'].$alinkmenu['link'].$alinkmenu['wrap_template']['1']; break; default: // render as table $alinkmenu['link'] = ''."\n" . $alinkmenu['link'] . "
        \n"; } // now check if class name is given // if so wrap article menu in div if(!empty($alinkmenu['class'])) { $alinkmenu['link'] = '
        \n" . $alinkmenu['link'] . "
        \n"; } $CNT_TMP .= $alinkmenu['wrap_all'][0].LF.$virt_article_title . $virt_article_subtitle . $alinkmenu['link'].LF.$alinkmenu['wrap_all'][1].LF; } unset($alinkmenu); return $CNT_TMP; } // $content['all'] = str_replace('{ARTICLE_MENU_ARCHIVE}', my_article_menu_archive() ,$content['all']); $content["all"] = preg_replace('/{ARTICLE_MENU_ARCHIVE:(.*?),(.*?),(.*?)}/e', 'my_article_menu_archive("$1","$2","$3")', $content["all"]); ?>