Article menu (count/arch/img/templ)

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,
  • number of articles which can be displayed (tag)
  • number of skipped articles (tag)
  • and one image (list or detail) from article configured by WxHxCxQ (tag)
  • word limit (999) with html rendering and allowed tags (tag)
  • 0-99 simple different templates using place holder (tag)
  • random article sort order (tag)
  • output archived articles (tag)
  • BBCode in titel and subtitel possible


rt_article_menu_archive V1.4 29.09.09


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, don´t use an ending comma)

   # category-ID      Articles in "category-ID" (-category-ID = the actual category), 
   # count-article    displays the the first "count-article" articles if available (0 = all articles), 
   + sXX              XX articles skipped  (0 = off), 
   + WxHxC            article image output WxHxC (width x height x cropped)  (cropped = 1|0), 
   + tXX              uses the layout from template No XX for output, 
   + rX               random article sort X = 0|1  (off|on), 
   + 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") 
   
  [#] = required, 
  [+] = optional


Syntax example: * {ARTICLE_MENU_ARCHIVE: -1, 0,} Actual category, none of the first articles is hidden , display all articles, * {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, 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, 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, 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}
   # 23       Article in category 23(ID), 
   # 5        displays the the first five articles if available, 
   + s0       no articles skipped, 
   + 50x50x1  article image output 50px x 50px cropped, 
   + t21      template No 21 selected, 
   + r1       random article sort on, 
   + w25      output of 25 words in summary, 
   + a3       output archived articles (article begin > NOW AND article end > NOW) 


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.4

Update

  Update: 29.09.09 KH: * max 100 configurable templates [tXX] (XX = template No.  e.g.: t4 or t14 or t56...)
                       * changed skip parameter from simple [digit] to "s[digit]" (e.g.: s3 or s6 or s13...)
                       + random sort order parameter in tag [r0|1]  (off|on)
                       + wordlimit paramter in tag [wXXX] (XXX = 0-999  where -1 = all  and  0 = off)
                       + output archived articles in tag
  Update: 27.09.09 KH: + 10 configurable templates
  Update: 26.09.09 KH: + rendering html, allowed tags, maxchar count changed to maxword  (the same like tease)
  Update: 25.09.09 KH: + thumb image from article list- or detail (if available)  (WxHxCxQ)
  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: 10.12.09 KH: + BBCode in titel and subtitel possible


Based on the cp article menu.

Tag: {ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxCxQ, tXX, rX, wXXX, aX}
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 !!)

Filename: rt_article_menu_archive.php

Location: template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



Inner parameters

Parameter set

with default values for some tagged parameters

// Sorting the output: all|archived|not archived
// ------------------------------------------
// 0: all articles
// 1: archive_status=1 AND article_begin<NOW() AND article_end<NOW()
// 2: archive_status=1 AND article_begin<NOW() AND article_end>NOW()
// 3: archive_status=1 AND article_begin>NOW() AND article_end>NOW()
 
// 4: archive_status=0 AND article_begin<NOW() AND article_end<NOW()
// 5: archive_status=0 AND article_begin<NOW() AND article_end>NOW()
// 6: archive_status=0 AND article_begin>NOW() AND article_end>NOW()

// Insert one of the previous number
$alinkmenu['article_archive_status_set']  = 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']                 = ' &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['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] 
 


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 100 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('<div class="template">','</div>'); 


// Template No: 0 (default) -----------------
$alinkmenu['template'][0] = '
<div class="entry">
  <div class="thumb">[LINK]{THUMBNAIL}[/LINK]</div>
  <div class="data">
    <div class="title">[LINK]{TITLE}{MORE}[/LINK]</div>
    <div class="stitle">{SUBTITLE}</div>
    <div class="summary">{SUMMARY}</div>
  </div>
  <div class="clear_both"></div>
</div>';
 
// Template No: 1 ---------------------------
$alinkmenu['template'][1] = '
<div class="entry">
  <div class="thumb" style="float:left; padding-right: 5px;">[LINK]{THUMBNAIL}[/LINK]</div>
  <div class="data">
    <div class="title">[LINK]{TITLE}{MORE}[/LINK]</div>
    <div class="stitle">{SUBTITLE}</div>
    <div class="summary">{SUMMARY}</div>
  </div>
  <div class="clear_both"></div>
</div>';

Please generate your own template between $alinkmenu['template'][X] = '. . . . .';
where X is the template No.


E.g. generated source from template No: 0:

<div class="teaser_wrap">
  <div class="template">
    <div class="entry">
      <div class="thumb" style="float: left; padding-right: 5px;">
        <a href="index.php?article_alias"><img src="img/cmsimage.php/50x50x1/b06c6... .jpg" alt="InmageName.jpg"></a>
      </div>
      <div class="data">
        <div class="title">
          <a href="index.php?article_alias">Article-title »</a>
        </div>
        <div class="stitle">Article-sub-title</div>
        <div class="summary">
          The summary text for testing »
        </div>
      </div>
      <div class="clear_both"></div>
    </div>
 
    <div class="entry">
    ...
    ...
    </div>
  </div>
</div>


Code v1.4

article menu archive v1.4

<?php
/*************************************************************************************
   Copyright notice

   (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.

   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license
   from the author is found in LICENSE.txt distributed with these scripts.

   This script is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   This copyright notice MUST APPEAR in all copies of the script!
--------------------------------------------------------------------------------------

15.03.09 KH (flip-flop) CP article menu cut out (frontend snippet)
   Enhanced for showing archived articles
   {ARTICLE_MENU_ARCHIVE:category-ID}
   If you use the automatic for category-ID, please set category-ID = -1 (the current category is selected)
   E.g.:{ARTICLE_MENU_ARCHIVE:-1}

16.08.09 KH Update: + counter for "How many of the first articles are to be hidden"
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide}
   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)
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-articles}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,s4}  (All three parameters must be set)
         Automatic category-ID, no article hidden, show the first for articles

25.09.09 KH Update: + thumb image from article list- or detail (if available)
   IMPORTANT: Changed the sequence from "count-hide, count-articles" to "count-articles, count-hide"

   {ARTICLE_MENU_ARCHIVE:category-ID, count-articles, count-hide,  WxHxCxQ}   like

   E.g.:{ARTICLE_MENU_ARCHIVE:-1,4,}  (Minimum paramters must be set: two + comma)
        Automatic category-ID, no article skipped, show the first for articles, no skip, no image

   E.g.:{ARTICLE_MENU_ARCHIVE:18,8,s3,100x80x0x90}
        category-ID=18, show eight articles, first three articles skipped,
        image 100px x 80px no cropping jpg Quality 90

   E.g.:{ARTICLE_MENU_ARCHIVE:18,8,s0,50x50x1}
        category-ID=18, show the first eight articles, no articles skipped,
        image 50px x 50px cropped

   The image parameter set (WxHxCxQ): %WIDTH%x%HEIGHT%x%CROP%x%QUALITY%
   by default this should be enough:  %WIDTH%x%HEIGHTx%CROP%

27.09.09 KH Update: + max 10 configurable templates

   E.g.:{ARTICLE_MENU_ARCHIVE:18,8, s0,50x50x1,t2}
        category-ID=18, show the first eight articles, no articles skipped,
        image 50px x 50px cropped, template N0. 2 in use

29.09.09 KH Update: * max 100 configurable templates  [0-99]
                    * changed skip parameter from simple [digit] to "s[digit]" e.g.: s3 or s6 or s13...
                    + random sort order in tag  r[0|1]
                    + wordlimit in tag  w[123]  max. 999  w0 = no words  w-1 = all words
                    + output archived articles in tag

   E.g.:{ARTICLE_MENU_ARCHIVE:18, 8, s0 ,50x50x1, t21, r1, w25, a3 }
        category-ID=18, show the first eight articles,
        no articles skipped,
        image 50px x 50px cropped,
        template No. 21 selected,
        random sort on,
        wordlimit = 25,
        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
*************************************************************************************/

//article menu enhanced

// {ARTICLE_MENU_ARCHIVE: category-ID, count-article, sXX, WxHxC, tXX, rX, wXXX, aX }

// $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
// $count_article: How many articles are to be shown (0=all)
// $WxHxCxQ: Image parameters %WIDTH%x%HEIGHT%x%CROP%[x%QUALITY%]
// tXX -parameter: No. 0-99 different free templates (TEMPLATES for  $alinkmenu['ul'] = 3)  (fallback=0)
// rX  -parameter: [0|1] random article sort order
// 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 = '') {


 // Test if the first two paramters have integer format
if (!(is_intval(trim($catid)) AND is_intval(trim($count_article)) )) {

    echo '============================================ <br>';
    echo '&nbsp;<b>ERROR</b>: Wrong integer parameter in {ARTICLE_MENU_ARCHIVE:...<br>';
    echo '============================================ <br>';
    return false;
}




global $aktion;

// User defination ============================================================
// =============== Simulated CP paramter ======================================


// TEMPLATES for  $alinkmenu[ul] = 3 ------------------------------------------

// Wrapper around all entries:   begin, end
$alinkmenu['wrap_template'] = array('<div class="template">','</div>');


// Template No: 0 (default) -----------------
$alinkmenu['template'][0] = '
<div class="entry">
  <div class="thumb">[LINK]{THUMBNAIL}[/LINK]</div>
  <div class="data">
    <div class="title">[LINK]{TITLE}{MORE}[/LINK]</div>
    <div class="stitle">{SUBTITLE}</div>
    <div class="summary">{SUMMARY}</div>
  </div>
  <div class="clear_both"></div>
</div>';

// Template No: 1 ---------------------------
$alinkmenu['template'][1] = '
<div class="entry">
  <div class="thumb" style="float:left; padding-right: 5px;">[LINK]{THUMBNAIL}[/LINK]</div>
  <div class="data">
    <div class="title">[LINK]{TITLE}{MORE}[/LINK]</div>
    <div class="stitle">{SUBTITLE}</div>
    <div class="summary">{SUMMARY}</div>
  </div>
  <div class="clear_both"></div>
</div>';

// Template No: 2  --------------------------
$alinkmenu['template'][2] = '
<div class="entry">
  <div class="thumb" style="float:right;">[LINK]{THUMBNAIL}[/LINK]</div>
  <div class="data">
    <div class="title">[LINK]{TITLE}{MORE}[/LINK]</div>
    <div class="stitle">{SUBTITLE}</div>
    <div class="summary">{SUMMARY}</div>
  </div>
  <div class="clear_both"></div>
</div>';


// Template No: 3  --------------------------
//$alinkmenu['template'][3] = '
//<div>
//.....
//</div>';

// END TEMPLATES -  -----------------------------------------------------------



// ContentPart head -------------------------
// Insert title/subtitle name and css for the virtual content part

$virt_article_title      = '';    // <div id="box02_top_header"><h1>MyTitle</h1></div>
$virt_article_subtitle   = '';    // <div id="box02_top_header"><h2>MySubTitle</h2></div>
// ------------------------------------------



// Parameter set ----------------------------

// Sorting the output: all|archived|not archived
// ------------------------------------------
// 0: all articles
// 1: archive_status=1 AND article_begin<NOW() AND article_end<NOW()
// 2: archive_status=1 AND article_begin<NOW() AND article_end>NOW()
// 3: archive_status=1 AND article_begin>NOW() AND article_end>NOW()

// 4: archive_status=0 AND article_begin<NOW() AND article_end<NOW()
// 5: archive_status=0 AND article_begin<NOW() AND article_end>NOW()
// 6: archive_status=0 AND article_begin>NOW() AND article_end>NOW()

// Insert one of the previous number

$alinkmenu['article_archive_status_set']  = 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']                 = ' &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['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 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"
---------------------------------------------
 $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_end DESC';

 $ao[2] = ' article_priorize DESC,'.$ao[2];
 --------------------------------------------
 */

// Sorting order ----------------------------
 $ao['2']  = ' article_priorize DESC,'; // !!! Don´t change!!!

 $ao['2'] .= ' article_sort ASC';       // Change for sort order


// END user defination ========================================================
// ============================================================================


// CSS classes for <ul> and <div> rendering -----------------------------------
// A very simple template (Please have a look for the {IMAGE} tag)

$alinkmenu['wrap_all']        = array('<div class="teaser_wrap">','</div>');  // Wrap around all
$alinkmenu['wrap_data']       = array('{IMAGE}<div class="data">','</div>');  // Data wrap begin, end
$alinkmenu['wrap_title']      = array('<div class="title">','</div>');        // Title wrap around all  begin, end
$alinkmenu['wrap_subtitle']   = array('<div class="stitle">','</div>');       // SubTitle wrap begin, end
$alinkmenu['wrap_summary']    = array('<div class="summary">','</div>');      // Wrap around summary  begin, end
$alinkmenu['class_active_link'] = 'active_link';                              // Active link class

$alinkmenu["style_before"]    = '<div class="before"></div>';  // Format before every data set.
$alinkmenu["style_behind"]    = '<div class="behind"></div>';  // Format behind every data set.


/* Example:

$alinkmenu['wrap_all']        = array('<div class="teaser_right">','</div>');                   // Wrap around all
$alinkmenu['wrap_data']       = array('','');                                                   // Data wrap begin, end
$alinkmenu['wrap_title']      = array('<div style="padding-bottom:2px; "><h6>','</h6></div>');  // Title wrap around all  begin, end
$alinkmenu['wrap_subtitle']   = array('<p style="font-size: 0.8em;  ">','</p>');                // 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"] = '<div style="margin:5px 0 8px 0;padding:0;height:1px;border:0;border-bottom:1px dotted #CCCCCC;clear:both"><!-- line //--></div>';
*/



 // 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 <ul> and <div> rendering"!!

// Set the {IMAGE} place holder where you want as shown above in "CSS classes".
// --------------------------------------
// A container
// <div class="thumb">
//    is autom. generated around the image if there is one available
// </div>
// --------------------------------------

// ----------------------------------------------------------------------------



// catch parameters from TAG ------------------------------

// $alinkmenu['article_archive_status_set']     = 2;  // E.g. Show entries with activated archive status?

// $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,a3}

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
    // === $alinkmenu['temp'][3] => random sort
    // === $alinkmenu['temp'][4] => wordlimit


    if ( count($alinkmenu['temp']) ) {


       foreach ($alinkmenu['temp'] as $value) {

              $value = preg_replace('/[^0-9arstwx-]/', '', $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
                  $alinkmenu['WxHxCxQ'] = $value;
              }
               elseif ( preg_match('/s{1}[0-9]{1,2}/', $value, $alinkmenu['temp1']) ) {   // "sXX" skip article
                     $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
                     $alinkmenu['template_no'] = (int)substr($alinkmenu['temp1']['0'],1,2);
                     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
                     $alinkmenu['random'] = (int)substr($alinkmenu['temp1']['0'],1,1);
                     $g = explode(',',$ao['2']);  // sortierung komplett entfernen
                     if ($alinkmenu['random'] AND count($g) == 2) {$ao['2'] = $g[0].', RAND()';}
//                     if ($alinkmenu['random']) $ao['2'] = ' RAND(),'.$ao['2'];          // sort random in DB Query
              }
              elseif ( preg_match('/w{1}[0-9-]{1,3}/', $value, $alinkmenu['temp1']) ) {   // "wXXX" for wordlimit count
                     $alinkmenu['wordlimit'] = (int)substr($alinkmenu['temp1']['0'],1,3);
              }
              elseif ( preg_match('/a{1}[0-6]{1,1}/', $value, $alinkmenu['temp1']) ) {    // "aX" archived articles?
                     $alinkmenu['article_archive_status_set'] = (int)substr($alinkmenu['temp1']['0'],1,1);
              }
       }
    }
}

 // Image parameter available?
 if ( empty($alinkmenu['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($alinkmenu['article_archive_status_set']) {
  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<NOW() AND article_end<NOW() ';
    break;

  case 2:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin<NOW() AND article_end>NOW() ';
    break;

  case 3:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin>NOW() AND article_end>NOW() ';
    break;

  case 4:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin<NOW() AND article_end<NOW() ';
    break;

  case 5:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin<NOW() AND article_end>NOW() ';
    break;

  case 6:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin>NOW() AND article_end>NOW() ';
    break;

  default:
    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() ';
}


$alink_sql  = "SELECT article_id, article_title ,article_subtitle, article_cid, article_summary, article_image ";
$alink_sql .= "FROM ".DB_PREPEND."phpwcms_article ";
$alink_sql .= "WHERE article_public=1 AND article_aktiv=1 AND article_deleted=0 ";
$alink_sql .= 'AND article_cid='.intval($alinkmenu["catid"]).' ';
$alink_sql .= $alinkmenu['article_archive_status'];

if(!empty($alinkmenu['hideactive'])) {

  $alink_sql .= 'AND article_id != '. $aktion[1] . ' ';
}
$alink_sql .= 'ORDER BY ' . $ao[2] ;


$result = _dbQuery($alink_sql);


 if(isset($result[$alinkmenu['leading_article_hide']]['article_id'])) {

  $count     = 0;
  // Max article output ( Input <= 0   --> All articles output )
  ($count_article <= 0) ? $count_art = -1000 : $count_art = 0;




  foreach($result as $value) {

   if( $count >= $alinkmenu['leading_article_hide'] ) {  // Hide first articles?

    if( $count_article > $count_art ) {  // Max article shown


      $tempRowSpan      = '';

     $value['article_summary'] = preg_replace('/<br[^>]*?>$/i', '', $value['article_summary']);  // article_summary


      // Summary ----------------------

      if($alinkmenu['headertext'] && !empty($value['article_summary'])) {

        $alinkmenu['sum'] = $value['article_summary'];

        // Clean the text ------

        if( $alinkmenu['wordlimit'] > 0 ) {
          $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');
          }
        } elseif ($alinkmenu['wordlimit'] == 0 ) $alinkmenu['sum'] = ''; // No Word output (-1)

      } 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
//         )
//     <img src="img/cmsimage.php/100x150x0x90/66.jpg" alt="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.'<div class="thumb">';
            if ($alinkmenu['is_image'] > 2) // image with link
                $alinkmenu['image'] .= '<a href="index.php?aid='.$value['article_id'].'">';


            $alinkmenu['imageonly']  = '<img src="img/cmsimage.php/'.$alinkmenu['WxHxCxQ'].'/';
            $alinkmenu['imageonly'] .= $alinkmenu['image_array'][$temp.'hash'].'.'.$alinkmenu['image_array'][$temp.'ext'].'"';
            $alinkmenu['imageonly'] .= ' alt="'.$alinkmenu['image_array'][$temp.'name'].'" />';

            $alinkmenu['image'] .= $alinkmenu['imageonly'];

            if ($alinkmenu['is_image'] > 2) // image with link
                $alinkmenu['image'] .= '</a>';

            $alinkmenu['image'] .= '</div>'.LF;
         }
         else  {
           $alinkmenu['image']     = '';
           $alinkmenu['imageonly'] = '';
         }
     }

     // END Image ---------------------



     // ArticleTitle ------------------
      $alinkmenu['title'] = render_bbcode_basics(html_specialchars($value['article_title']));

     // SubTitle ----------------------
      $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ?
      render_bbcode_basics(html_specialchars($value['article_subtitle'])) : '';


      // set link or link with active link class --------------------

      $alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'">';

      if (empty($alinkmenu['hideactive']) AND ($value['article_id'] == $aktion[1])) {
          $alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'" '.get_class_attrib($alinkmenu['class_active_link']).'>';
     }



      switch($alinkmenu['ul']) {

       case 1:   // render as unordered list

            $alinkmenu['link'] .= LF.$alinkmenu["style_before"].LF;

            $alinkmenu['link'] .= '<li class="entry">'.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'].'</a>'.$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]."</li>\n";

            $alinkmenu['link'] .= LF.$alinkmenu["style_behind"].LF;
            break;




        case 2:   // render as div
            $alinkmenu['link'] .= LF.$alinkmenu["style_before"].LF;

            $alinkmenu['link'] .= '<div class="entry">'.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'].'</a>'.$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]."</div>\n";

            $alinkmenu['link'] .= LF.$alinkmenu["style_behind"].LF;
            break;


        case 3:   // render with template
            $alinkmenu['temp'] = $alinkmenu['template'][$alinkmenu['template_no']];

            $alinkmenu['temp'] = str_replace('[LINK]'     , $alinkmenu['link_wrap']           , $alinkmenu['temp']);
            $alinkmenu['temp'] = str_replace('[/LINK]'    , '</a>'                            , $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'] = "<tr>\n\t<td>" .$alinkmenu['wrap_subtitle'][0].$alinkmenu['subtitle'].$alinkmenu['wrap_subtitle'][1]. "</td>\n</tr>\n";
            }
            // Summary - ---------------------
            if($alinkmenu['sum'] !== false) {
                $tempRowSpan    = ' rowspan="3"';
                $alinkmenu['sum'] = "<tr>\n\t<td>" .$alinkmenu['wrap_summary'][0].LF.$alinkmenu['sum'].LF.$alinkmenu['wrap_summary'][1] . "</td>\n</tr>\n";
            }

            $alinkmenu['link'] .= "<tr>\n\t<td valign=\"top\"".$tempRowSpan." nowrap=\"nowrap\">".$GLOBALS["template_default"]["article"]["link_article_sign"]."</td>\n\t";
            $alinkmenu['link'] .= '<td>'.$alinkmenu['wrap_title'][0].$alinkmenu['link_wrap'];
            $alinkmenu['link'] .= $alinkmenu['title'].$alinkmenu['more'].'</a>'.$alinkmenu['wrap_title'][1]."</td>\n</tr>\n";
            $alinkmenu['link'] .= $alinkmenu['subtitle'];
            $alinkmenu['link'] .= $alinkmenu['sum'];

      }



     // Image tag available, only for <ul> and <div> 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'] = "<ul>\n" . $alinkmenu['link'] . "</ul>\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'] = '<table border="0" cellspacing="0" cellpadding="0">'."\n" . $alinkmenu['link'] . "</table>\n";

  }

  // now check if class name is given
  // if so wrap article menu in div
  if(!empty($alinkmenu['class'])) {

    $alinkmenu['link'] = '<div class="' . html_specialchars($alinkmenu['class']) . "\">\n" . $alinkmenu['link'] . "</div>\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"]);

?>
english/phpwcms_replacer_rts/frontend_render/article-menu-archive/article-menu-archive-img-template.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0