NAVIGATION
This shows you the differences between two versions of the page.
english:phpwcms_replacer_rts:frontend_render:newx [2012/02/09 18:35] Claus |
english:phpwcms_replacer_rts:frontend_render:newx [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
- | ===== {NEWX: Counter : category-IDs : Keywords : Mode} ===== | + | ===== {NEWX: Counter : category-IDs : Keywords : Mode [hidden categories]} ===== |
- | FIXME Beta -> TRANSLATE please test | + | FIXME TRANSLATE please test |
- | Original-TAG [[http://www.phpwcms-docu.de/link_tags_.phtml|{NEW:Anzahl_angezeigter_Links:ID}]] enhanced to allow a search for articles keywords in different categories.. \\ | + | Original TAG [[http://www.phpwcms-docu.de/link_tags_.phtml|{NEW:Amount_of_shown_links:ID}]] enhanced to allow a search for articles keywords in different categories.. \\ |
Line 17: | Line 17: | ||
Docu: [[http://www.phpwcms-docu.de/link_tags_.phtml]] | Docu: [[http://www.phpwcms-docu.de/link_tags_.phtml]] | ||
- | Forum: [[http://forum.phpwcms.org/viewtopic.php?p=129101|Replacement Tag NEW mit Filterung]] | + | Forum: [[http://forum.phpwcms.org/viewtopic.php?p=129101|Replacement Tag NEW with filter]] |
- | TAG: **{NEWX: Counter : Category-IDs : Keywords : Mode}** is a "cut-out piece of code from the System frontend" enhanced by the possibility to search from or below one or more given categor(y)ies. This is especially helpful for multilingual pages. | + | TAG: **{NEWX: Counter : Category-IDs : Keywords : Mode [hidden categories]}** is a "cut-out piece of code from the System frontend" enhanced by the possibility to search from or below one or more given categor(y)ies. This is especially helpful for multilingual pages. |
Line 38: | Line 38: | ||
- | * Counter: max. amount of links to new / changed articles | + | * **Counter:** max. amount of links to new / changed articles |
- | * Category-IDs: categories to be searched, separated by comma | + | * **Category-IDs:** categories to be searched, separated by comma |
- | * Keywords: naming the keywords for which will be searched (optional: no keyword) | + | * **Keywords:** naming the keywords for which will be searched (optional: no keyword) |
- | * Mode: which categories have to be searched: | + | * **Mode:** which categories have to be searched: |
* 0 = only the given category | * 0 = only the given category | ||
* 1 = the given category and below | * 1 = the given category and below | ||
* 2 = only below the given category | * 2 = only below the given category | ||
+ | |||
+ | * **Hidden categories:** //(optional since V1.0)// | ||
+ | * 0 = Article in hidden categories are not included. | ||
+ | * 1 = Article in hidden categories are included. | ||
+ | |||
**Always fill in all fields:** Z.B. \\ | **Always fill in all fields:** Z.B. \\ | ||
* **{NEWX:5:0::0}** -> //Search without keywords only within category-ID=0 = home // | * **{NEWX:5:0::0}** -> //Search without keywords only within category-ID=0 = home // | ||
- | * **{NEWX:5:0::1}** -> //Search without keywordswithin category-ID=0 = home and below // | + | * **{NEWX:5:0::1}** -> //Search without keywords within category-ID=0 = home and below // |
* **{NEWX:5:0:tip,top,flip,flop:2}** -> //Search for keywords is starting below-ID=0 = home// | * **{NEWX:5:0:tip,top,flip,flop:2}** -> //Search for keywords is starting below-ID=0 = home// | ||
* **{NEWX:5:12,19:tip,top,flip,flop:2}** -> //Output of the first 5 entries (amount is adjustable), searching for any occurance of any given keyword, starting below category 12 and 19 // | * **{NEWX:5:12,19:tip,top,flip,flop:2}** -> //Output of the first 5 entries (amount is adjustable), searching for any occurance of any given keyword, starting below category 12 and 19 // | ||
- | e.g.: | + | |
+ | * **Update** V1.0 08.02.2012: An extension to be able to view items in hidden categories. [:0|:1] | ||
+ | * **{NEWX: list counter : Category-IDs : keywords : mode : hidden categories}** \\ **{NEWX:5:3::1:1}** -> //Search without keywords within category-ID=3 and below even if they are hidden // | ||
+ | |||
+ | |||
+ | |||
+ | * **Update** V1.1 14.02.2012: If one of the keywords %%"hidden" or "versteckt"%% is entered in the category field %%"keywords"%%, the articles of this category are not displayed. The category switch %%"[x] hidden"%% does not have to be set. | ||
+ | |||
+ | \\ | ||
+ | E.g.: | ||
Given structure: | Given structure: | ||
Line 79: | Line 93: | ||
\\ | \\ | ||
- | ==== Script V 0.9 ==== | + | |
+ | ==== Example: ==== | ||
+ | |||
+ | **Backend/Frontend output** | ||
+ | |||
+ | |||
+ | {{:deutsch:ersetzer_rts:frontend_render:newx_be_fe_1.gif|}} | ||
+ | |||
+ | |||
+ | |||
+ | ~~UP~~ | ||
+ | |||
+ | ===== Script V 0.9 ===== | ||
File: template/inc_script/frontend_render/rt_newx.php | File: template/inc_script/frontend_render/rt_newx.php | ||
Line 385: | Line 411: | ||
\\ | \\ | ||
- | ==== Settings: ==== | + | ===== Script V 1.0 ===== |
- | **In the file:** config/phpwcms/conf.template_default.inc.php | + | **Update V1.0 08.02.2012**: Enhanced by the possibility to show articles in hidden categories too [:0|:1] |
+ | * {NEWX: counter : category-IDs : keywords : mode : hidden category} | ||
- | **Example:** | ||
- | <code php> | ||
- | // new articles | ||
- | $template_default['news']['before'] = '<div class="new-tag">'; | ||
- | $template_default['news']['after'] = '</div>'; | ||
- | $template_default['news']['link_before'] = '<p>'; | ||
- | $template_default['news']['link_after'] = '</p>'; | ||
- | $template_default['news']['link_symbol'] = '» '; | ||
- | $template_default['news']['link_target'] = ''; | ||
- | $template_default['news']['link_length'] = 0; //if 0 no limit | ||
- | $template_default['news']['cut_title_add'] = '…'; | ||
- | $template_default['news']['date_language'] = 'DE'; // DE=German, IT=Italian, FR=French, ES = Spanish, DA = Danish, NO = Norwegian | ||
- | $template_default['news']['date_format'] = 'd.m.Y'; //if empty -> no Date | ||
- | $template_default['news']['date_before'] = '<span class="datelink"> '; | ||
- | $template_default['news']['date_after'] = ' - </span>'; | ||
- | $template_default['news']['sort_by'] = 'udate'; // 'cdate' = Creation date, or 'udate' = update date, ldate = start date, kdate = end date | ||
- | </code> | + | **Update 08.02.2012** |
+ | * Update: New variable @hidden. | ||
+ | * {NEWX: counter : category-IDs : keywords : [0|1|2] mode : [0|1] hidden categories} | ||
+ | * Will show articles, even if they reside in hidden category, when the switch is set | ||
+ | * {NEWX:9:12,23,56::2:1} --> will show the first 9 articles below categories 12,23,56 - even in case these categories are hidden. | ||
+ | * {NEWX:9:12,23,56::2:0} oder {NEWX:9:12,23,56::2} --> same as above, but no articles of hidden categories will be shown. | ||
+ | * User //(Custom)//-switch in script to show articles where no "more...[ ]" - switch is set. | ||
+ | |||
+ | \\ | ||
+ | **File:** template/inc_script/frontend_render/rt_newx.php | ||
+ | <code php|h {NEWX:count:category-IDs:key words:mode:hidden categories} |h> | ||
+ | <?php | ||
+ | /******************************************************************************************* | ||
+ | Copyright notice | ||
+ | |||
+ | (c) 2002-2012 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.htm | ||
+ | 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! | ||
+ | ------------------------------------------------------------------------------------------- | ||
+ | V 1.0 | ||
+ | 10.03.11 KH (flip-flop) RT NEW cut out (frontend snippet) | ||
+ | 08.02.12 KH (flip-flop) Update: New var @hidden. Custom switch for show article without [more] is set. | ||
+ | RT NEW erweitert um Schluesselwoerter, Kategorienliste (IDs) und Modus | ||
+ | {NEWX:count:category-IDs:key word´s:category-ID:Mode} | ||
+ | ...Please always fill out all fields: e.g. | ||
+ | {NEWX:5::tip,top,flip,flop:0} -> Output first 5 entries, search only in cad-ID=0 = home | ||
+ | {NEWX:7:12,23,56:tip,top,flip,flop:1} -> Output first 7 entries, search beginning in cad-ID=12,23,56 downstares in sub cats | ||
+ | {NEWX:9:12,23,56::2} -> Output first 9 entries, search beginning behind cad-ID=12,23,56 downstares in sub cats, no keywords | ||
+ | |||
+ | Update 08.02.12 : | ||
+ | {NEWX:count:category-IDs:key word´s:Mode:show_hidden_categories} | ||
+ | Show articles in hidden categories if set to 1 | ||
+ | {NEWX:9:12,23,56::2:1} -> Output first 9 entries, search beginning behind cad-ID=12,23,56 downstares in sub cats, no keywords, show article in hidden categories | ||
+ | {NEWX:9:12,23,56::2:0} or {NEWX:9:12,23,56::2} -> The same as above, but don´t show article in hidden categories | ||
+ | |||
+ | Custom switch @more: | ||
+ | - 0 = Show article only if @more is [x] | ||
+ | - 1 = Show article if @more is [x] or [_] | ||
+ | *********************************************************************************************/ | ||
+ | // ------------------------------------------------------------------------------------------- | ||
+ | // obligate check for phpwcms constants | ||
+ | if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} | ||
+ | // ------------------------------------------------------------------------------------------- | ||
- | \\ | ||
- | === CSS: === | ||
- | File: e.g. in template/inc_css/frontend.css | ||
- | **Example:** | + | if(strpos($content["all"],'{NEWX:') !== false) { |
- | <code css> | + | |
- | /* NEW TAG --------------------------------- */ | + | |
- | .new-tag { | + | // CUSTOM ------------------------------------------------------------------------------------ |
- | font-family: verdana; /* "Courier New", monospace; */ | + | |
- | font-size:90%; | + | |
- | } | + | |
- | .new-tag a { | + | $more = 1; // +KH 08.02.12: [0|1] 0 = Show article only if @more is [x] | 1 = if @more is [x] or [_] |
- | color: red; | + | |
- | } | + | // ------------------------------------------------------------------------------------------- |
- | .new-tag .datelink { | + | // +KH 08.02.12: include/inc_front/front.func.inc.php |
- | font-size:80%; | + | function my_getStructureLevelDisplayStatus(&$level_ID, &$current_ID, $hidden=0) { |
- | color: darkred; | + | |
- | } | + | |
- | </code> | + | |
- | \\ | + | // Datensatz einer Unterkategorie der aktuellen Kategorie und nicht Kategorie 0 (home)) |
- | ==== Example: ==== | + | if($GLOBALS['content']['struct'][$level_ID]['acat_struct'] == $current_ID && $level_ID) { |
- | **Backend/Frontend output** | + | // Kategorie fuer registrierte Benutzer und nicht eingeloggt |
+ | if($GLOBALS['content']['struct'][$level_ID]['acat_regonly'] && !FEUSER_LOGIN_STATUS) { | ||
+ | return false; | ||
+ | } | ||
+ | if(empty($GLOBALS['content']['struct'][$level_ID]['acat_hidden'])) { | ||
+ | return true; | ||
+ | } elseif($GLOBALS['content']['struct'][$level_ID]["acat_hidden"] == 2 && isset($GLOBALS['LEVEL_KEY'][$level_ID])) { | ||
+ | return true; | ||
+ | } elseif ($hidden) { // +KH: IF hidden flag is set: All categories, including the hidden. | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | // +KH 08.02.12: include/inc_front/front.func.inc.php | ||
+ | function my_getStructureChildData($level_id=0, $hidden=0) { | ||
+ | if( !isset($GLOBALS['content']['struct'][$level_id]) ) return array(); | ||
+ | $struct_data = array(); | ||
+ | foreach($GLOBALS['content']['struct'] as $key => $value) { | ||
+ | if( my_getStructureLevelDisplayStatus($key, $level_id, $hidden) ) { | ||
+ | $struct_data[$key] = $value; | ||
+ | } | ||
+ | } | ||
+ | return $struct_data; | ||
+ | } | ||
- | {{:deutsch:ersetzer_rts:frontend_render:newx_be_fe_1.gif|}} | ||
+ | function my_newX_keywords ($keywords = "") { | ||
+ | |||
+ | $keywords = str_replace("ALLKEYWORDS", $GLOBALS['content']['all_keywords'].',', $keywords); | ||
+ | |||
+ | // replace unwanted chars and convert to wanted | ||
+ | $keywords = str_replace(";", ",", $keywords); | ||
+ | $keywords = str_replace("'", "", $keywords); | ||
+ | $keywords = str_replace(" ", ",", $keywords); | ||
+ | $keywords = str_replace(",,", ",", $keywords); | ||
+ | |||
+ | // choose comma separated keywords | ||
+ | $keywordarray = explode (",", $keywords); | ||
+ | $keywordarray = array_map('trim', $keywordarray); | ||
+ | $keywordarray = array_diff($keywordarray, array('')); | ||
+ | $keywordarray = array_unique($keywordarray); | ||
+ | $keywordarray = array_map('strtoupper', $keywordarray); | ||
+ | // check for empty keywords or keywords smaller than 3 chars | ||
+ | if(is_array($keywordarray) && count($keywordarray)) { | ||
+ | foreach($keywordarray as $key => $value) { | ||
+ | |||
+ | if(substr($keywordarray[$key], 0, 1) == '-') { | ||
+ | $doNotUse = substr($keywordarray[$key], 1); | ||
+ | foreach($keywordarray as $key2 => $value2) { | ||
+ | if($doNotUse == $value2) { | ||
+ | unset($keywordarray[$key2]); | ||
+ | unset($keywordarray[$key]); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if(isset($keywordarray[$key]) && (strlen($keywordarray[$key]) < 3 || empty($keywordarray[$key]))) { | ||
+ | unset($keywordarray[$key]); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if(is_array($keywordarray) && count($keywordarray)) { | ||
+ | $where = ""; | ||
+ | foreach($keywordarray as $value) { | ||
+ | //build where keyword = blabla | ||
+ | $where .= ($where) ? " OR " : ""; | ||
+ | //replace every "'" to "''" for security reasons with aporeplace() | ||
+ | $where .= "article_keyword LIKE '%".aporeplace($value)."%'"; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | return $where; | ||
+ | } | ||
+ | // ------------------------------------------------- | ||
+ | // Parse cat id string | ||
+ | |||
+ | function my_newX_cat_id ($cat_id = "") { | ||
+ | |||
+ | // replace unwanted chars and convert to wanted | ||
+ | $cat_id = str_replace(";", ",", $cat_id); | ||
+ | $cat_id = str_replace("'", "", $cat_id); | ||
+ | $cat_id = str_replace(" ", ",", $cat_id); | ||
+ | $cat_id = str_replace(",,", ",", $cat_id); | ||
+ | |||
+ | // choose comma separated keywords | ||
+ | $cat_id_array = explode (",", $cat_id); | ||
+ | $cat_id_array = array_map('trim', $cat_id_array); | ||
+ | $cat_id_array = array_diff($cat_id_array, array('')); | ||
+ | $cat_id_array = array_unique($cat_id_array); | ||
+ | $cat_id_array = array_map('strtoupper', $cat_id_array); | ||
+ | |||
+ | // check for empty cat_ids or cat_ids smaller than 1 chars | ||
+ | if(is_array($cat_id_array) && count($cat_id_array)) { | ||
+ | foreach($cat_id_array as $key => $value) { | ||
+ | |||
+ | if(substr($cat_id_array[$key], 0, 1) == '-') { | ||
+ | $doNotUse = substr($cat_id_array[$key], 1); | ||
+ | foreach($cat_id_array as $key2 => $value2) { | ||
+ | if($doNotUse == $value2) { | ||
+ | unset($cat_id_array[$key2]); | ||
+ | unset($cat_id_array[$key]); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if(isset($cat_id_array[$key]) && (strlen($cat_id_array[$key]) < 1 )) { | ||
+ | unset($cat_id_array[$key]); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // return $where; | ||
+ | return $cat_id_array; | ||
+ | } | ||
+ | // ------------------------------------------------- | ||
- | \\ | + | function newX_buildStruct_TopDown($start=0, $hidden=0, &$my_cat_id='') { // KH: V1.1 25.01.2011 |
+ | |||
+ | $struct = my_getStructureChildData($start, $hidden); | ||
+ | foreach($struct as $value) { | ||
+ | $my_cat_id .= ($my_cat_id != '') ? ','.$value['acat_id'] : $value['acat_id']; | ||
+ | newX_buildStruct_TopDown($value['acat_id'], $hidden, $my_cat_id); | ||
+ | } | ||
+ | |||
+ | return $my_cat_id; | ||
+ | } | ||
+ | // ------------------------------------------------- | ||
- | ===== Script V 1.0 ===== | ||
- | * Update V1.0 08.02.2012: Enhanced by the possibility to show articles in hidden categories too [:0|:1] | + | function my_get_newX_articles(&$template_default, $max_cnt_links=10, $cat=0, $keywords='', $sub_cat=0, $hidden=0, $more=0, $dbcon) { |
- | * {NEWX: counter : category-IDs : keywords : mode : hidden category} | + | // find all new articles |
+ | |||
+ | |||
+ | $cat = (empty($cat)) ? '0': trim($cat); | ||
+ | $save_cat = $cat; | ||
+ | |||
+ | //+KH:read cCategories from string | ||
+ | $cat_id_array = my_newX_cat_id($cat); | ||
+ | |||
+ | //+KH: Search sub-categories required?? | ||
+ | if (isset($sub_cat) AND $sub_cat) { | ||
+ | |||
+ | $temp = ''; | ||
+ | |||
+ | foreach ($cat_id_array as $value) { | ||
+ | $temp = newX_buildStruct_TopDown($value, $hidden); // find all permitted IDs behind $cat_id | ||
+ | if (!empty($temp)) $temp .= ','; | ||
+ | } | ||
+ | |||
+ | $temp = substr ($temp, 0, -1); // Delete the last comma | ||
+ | |||
+ | if (!empty($temp)) { | ||
+ | $cat = $temp; | ||
+ | if ($sub_cat == 1) { | ||
+ | |||
+ | if(empty($GLOBALS['content']['struct'][$save_cat]['acat_hidden']) OR $hidden) // +KH: 08.02.12 | ||
+ | $cat .= ','.$save_cat; // +KH: 20.01.11 add start category | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else $sub_cat = false; | ||
+ | |||
+ | $max_cnt_links = intval($max_cnt_links); | ||
+ | |||
+ | $limit = (empty($max_cnt_links)) ? '' : ' LIMIT '.$max_cnt_links; | ||
+ | |||
+ | |||
+ | |||
+ | $cat = "article_cid IN (".$cat.") AND "; | ||
+ | |||
+ | $sql = 'SELECT article_id, article_title, article_cid, article_alias, article_redirect, article_morelink, '; | ||
+ | |||
+ | switch( (empty($template_default["sort_by"]) ? '' : strtolower($template_default["sort_by"])) ) { | ||
+ | |||
+ | case 'cdate': //use real creation date | ||
+ | $sql .= "article_created AS article_date "; | ||
+ | $sorting = 'article_created'; | ||
+ | break; | ||
+ | |||
+ | case 'ldate': //use live/start date | ||
+ | $sql .= "UNIX_TIMESTAMP(article_begin) AS article_date "; | ||
+ | $sorting = 'article_begin'; | ||
+ | break; | ||
+ | |||
+ | case 'kdate': //use kill/end date | ||
+ | $sql .= "UNIX_TIMESTAMP(article_end) AS article_date "; | ||
+ | $sorting = 'article_end'; | ||
+ | break; | ||
+ | |||
+ | default: $sql .= "UNIX_TIMESTAMP(article_tstamp) AS article_date "; | ||
+ | $sorting = 'article_tstamp'; | ||
+ | } | ||
+ | |||
+ | $sql .= "FROM ".DB_PREPEND."phpwcms_article WHERE ".$cat; | ||
+ | // VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode | ||
+ | switch(VISIBLE_MODE) { | ||
+ | case 0: $sql .= "article_public=1 AND article_aktiv=1 AND "; | ||
+ | break; | ||
+ | case 1: $sql .= "article_uid=".$_SESSION["wcs_user_id"]." AND "; | ||
+ | break; | ||
+ | //case 2: admin mode no additional neccessary | ||
+ | } | ||
+ | |||
+ | // +KH: Keyword added | ||
+ | $where = my_newX_keywords($keywords); | ||
+ | |||
+ | if (!empty($where)) | ||
+ | $where = ' AND ('.$where.')'; | ||
+ | else $where = ''; | ||
+ | |||
+ | $sql .= "article_deleted=0 AND article_begin < NOW() AND article_end > NOW() ".$where." "; | ||
+ | $sql .= "ORDER BY ".$sorting." DESC".$limit; | ||
+ | |||
+ | // new articles list | ||
+ | $new_links = ""; | ||
+ | $target = ($template_default["link_target"]) ? ' target="'.$template_default["link_target"].'"' : ''; | ||
+ | |||
+ | $result = _dbQuery($sql); | ||
+ | $count = 0; | ||
+ | |||
+ | foreach($result as $row) { | ||
+ | |||
+ | if(empty($row['article_redirect'])) { | ||
+ | // Feld more im Artikel nicht gesetzt und Schalter @more nicht aktiv // +KH 08.02.12 | ||
+ | if(empty($row['article_morelink']) AND !$more) { | ||
+ | continue; | ||
+ | } | ||
+ | $article_link = 'index.php?'.setGetArticleAid($row).'"'.$target; | ||
+ | } else { | ||
+ | $redirect = get_redirect_link($row['article_redirect'], ' ', ''); | ||
+ | $article_link = $redirect['link'].'"'.$redirect['target']; | ||
+ | } | ||
+ | |||
+ | $count++; | ||
+ | if($template_default["link_length"] && strlen($row['article_title']) > $template_default["link_length"]) { | ||
+ | $article_title = substr($row['article_title'], 0, $template_default["link_length"]).$template_default["cut_title_add"]; | ||
+ | } else { | ||
+ | $article_title = $row['article_title']; | ||
+ | } | ||
+ | $article_title = html_specialchars($article_title); | ||
+ | if(trim($template_default["date_format"])) { | ||
+ | $article_date = $template_default["date_before"] . | ||
+ | html_specialchars( | ||
+ | international_date_format( | ||
+ | $template_default["date_language"], | ||
+ | $template_default["date_format"], | ||
+ | $row['article_date'] | ||
+ | ) | ||
+ | ) . | ||
+ | $template_default["date_after"]; | ||
+ | // $article_title; | ||
+ | } | ||
+ | $new_links .= $template_default["link_before"]; | ||
+ | $new_links .= $template_default["link_symbol"]; | ||
+ | // -------------------------------------------------------- | ||
+ | // +KH: if you need an other order of date and article, please change the next line: $article_title.$article_date | ||
+ | // -------------------------------------------------------- | ||
+ | $new_links .= '<a href="' . $article_link . '>' . $article_date.$article_title . '</a>'; | ||
+ | $new_links .= $template_default["link_after"]; | ||
+ | } | ||
+ | |||
+ | //enclose whole | ||
+ | if($new_links) $new_links = $template_default["before"].$new_links.$template_default["after"]; | ||
+ | |||
+ | // parses all system RTs +KH 25.01.2011 | ||
+ | $new_links = html_parser($new_links); | ||
+ | |||
+ | return $new_links; | ||
+ | } | ||
+ | // ------------------------------------------------------------------------------------------- | ||
+ | |||
+ | |||
+ | // +KH: all new article list sorted by date | ||
+ | if(strpos($content["all"],'{NEWX:') !== false) { | ||
+ | $content["all"] = preg_replace('/\{NEWX\}/e','my_get_newX_articles($template_default["news"],"10","0","","1","0",$db);',$content["all"]); | ||
+ | // NEWX: Count : catID,catID,catID : keyword,keyword,keyword : mode : hidden} | ||
+ | $content["all"] = preg_replace('/\{NEWX:(\d+):([0-9,]*):(.*?):(\d?):?([0|1]?)\}/e','my_get_newX_articles($template_default["news"],"$1","$2","$3","$4","$5",$more,$db);',$content["all"]); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | ?> | ||
+ | </code> | ||
- | **Update 08.02.2012** | ||
- | * Update: New variable @hidden. | ||
- | * {NEWX: counter : category-IDs : keywords : [0|1|2] mode : [0|1] hidden categories} | ||
- | * Will show articles, even if they reside in hidden category, when the switch is set | ||
- | * {NEWX:9:12,23,56::2:1} --> will show the first 9 articles below categories 12,23,56 - even in case these categories are hidden. | ||
- | * {NEWX:9:12,23,56::2:0} oder {NEWX:9:12,23,56::2} --> same as above, but no articles of hidden categories will be shown. | ||
- | * User //(Custom)//-switch in script to show articles where no "more...[ ]" - switch is set. | ||
- | |||
\\ | \\ | ||
- | **Datei:** template/inc_script/frontend_render/rt_newx.php | ||
- | <code php|h {NEWX:count:category-IDs:key words:mode} |h> | + | ===== Script V 1.1 ===== |
+ | |||
+ | |||
+ | **Update V1.1 14.02.2012**: As V1.0, in addition | ||
+ | * If one of the keywords "hidden" or "versteckt" is entered in the category field %%"keywords"%%, the articles of this category are not displayed. The category switch %%"[x] hidden"%% is not necessary for this. | ||
+ | |||
+ | \\ | ||
+ | **File:** template/inc_script/frontend_render/rt_newx.php | ||
+ | |||
+ | <code php|h {NEWX:count:category-IDs:key words:mode:hidden category} |h> | ||
<?php | <?php | ||
/******************************************************************************************* | /******************************************************************************************* | ||
Line 478: | Line 809: | ||
either version 2 of the License, or (at your option) any later version. | 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.htm | ||
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html | 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 | A copy is found in the textfile GPL.txt and important notices to the license | ||
Line 489: | Line 819: | ||
This copyright notice MUST APPEAR in all copies of the script! | This copyright notice MUST APPEAR in all copies of the script! | ||
------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ||
- | V 1.0 | + | V 1.1 |
10.03.11 KH (flip-flop) RT NEW cut out (frontend snippet) | 10.03.11 KH (flip-flop) RT NEW cut out (frontend snippet) | ||
- | 08.02.12 KH (flip-flop) Update: New var @hidden. Custom switch for show article without [more] is set. | + | 08.02.12 KH (flip-flop) Update V1.0: New var @hidden. Custom switch for show article without [more] is set. |
+ | 14.02.12 KH (flip-flop) Update V1.1: If in BE the keyword is set to "hidden" or "versteckt", the articles of the category are not displayed. (Don´t need [x] hidden). | ||
+ | |||
RT NEW erweitert um Schluesselwoerter, Kategorienliste (IDs) und Modus | RT NEW erweitert um Schluesselwoerter, Kategorienliste (IDs) und Modus | ||
{NEWX:count:category-IDs:key word´s:category-ID:Mode} | {NEWX:count:category-IDs:key word´s:category-ID:Mode} | ||
Line 535: | Line 867: | ||
return false; | return false; | ||
} | } | ||
+ | // Update V1.1: Wenn die Schluesselwoerter "hidden" oder "versteckt" gesetzt sind, dann verbergen | ||
+ | if (!empty($GLOBALS['content']['struct'][$level_ID]['acat_keywords'])) { | ||
+ | |||
+ | if( (stripos($GLOBALS['content']['struct'][$level_ID]['acat_keywords'], 'hidden' ) !== FALSE) OR | ||
+ | (stripos($GLOBALS['content']['struct'][$level_ID]['acat_keywords'], 'versteckt') !== FALSE) ) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | |||
if(empty($GLOBALS['content']['struct'][$level_ID]['acat_hidden'])) { | if(empty($GLOBALS['content']['struct'][$level_ID]['acat_hidden'])) { | ||
return true; | return true; | ||
Line 670: | Line 1011: | ||
function my_get_newX_articles(&$template_default, $max_cnt_links=10, $cat=0, $keywords='', $sub_cat=0, $hidden=0, $more=0, $dbcon) { | function my_get_newX_articles(&$template_default, $max_cnt_links=10, $cat=0, $keywords='', $sub_cat=0, $hidden=0, $more=0, $dbcon) { | ||
// find all new articles | // find all new articles | ||
- | |||
$cat = (empty($cat)) ? '0': trim($cat); | $cat = (empty($cat)) ? '0': trim($cat); | ||
Line 822: | Line 1162: | ||
?> | ?> | ||
</code> | </code> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | |||
Line 839: | Line 1184: | ||
+ | ==== Settings: ==== | ||
- | ==== Einstellungen: ==== | + | **In the file:** config/phpwcms/conf.template_default.inc.php |
- | **In der Datei:** config/phpwcms/conf.template_default.inc.php | + | **Example:** |
- | + | ||
- | **Beispiel:** | + | |
<code php> | <code php> | ||
// new articles | // new articles | ||
Line 865: | Line 1209: | ||
\\ | \\ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
==== CSS: ==== | ==== CSS: ==== | ||
Line 911: | Line 1233: | ||
\\ | \\ | ||
+ | |||
+ | |||