{NEW:10} problem - not right solution...
{NEW:10} problem - not right solution...
Hello.
In "site structure" I have 'New". I can put articles there. And on homepage I want f.e. to show shortcuts to last 10 of them. The shortcut (the link) should be tect + little image. How can I do this? Becouse "{NEW:10}" shows articles from everywhere.
And how can I put another page "news archive" with all links from this part?
Regards, Marek.
In "site structure" I have 'New". I can put articles there. And on homepage I want f.e. to show shortcuts to last 10 of them. The shortcut (the link) should be tect + little image. How can I do this? Becouse "{NEW:10}" shows articles from everywhere.
And how can I put another page "news archive" with all links from this part?
Regards, Marek.
hello
use the related tag!
give them an keyword e.g. *NEW*
http://www.phpwcms-docu.de/link_tags.phtml
use the related tag!
give them an keyword e.g. *NEW*
Code: Select all
{RELATED:list_count_:keyword}
{NEWSA} Tag
This code save as file phpwcms_template/inc_script/frontend_render/newsa.php
and this code save as file phpwcms_template/inc_script/frontend_init/newsa.php
now chek vars in conf.inc.php, its is probably like this
now {NEWSA} tag worked
usage:
{NEWSA:10} - show last 10 active articles(exluding current article) from all section where categories is active, public, not hidden and not trashed
{NEWSA:10:CURRENT} - show last 10 articles from current section(exluding current article)
{NEWSA:10:_ID_NUMBER_} - show last 10 articles from _ID_NUMBER_ section
good luck
Code: Select all
<?php
/*************************************************************************************
usage:
{NEWSA:10} - show last 10 active articles(exluding current article) from all section where categories is active, public, not hidden and not trashed
{NEWSA:10:CURRENT} - show last 10 articles from current section(exluding current article)
{NEWSA:10:_ID_NUMBER_} - show last 10 articles from _ID_NUMBER_ section
*************************************************************************************/
// all new article list sorted by date
if( ! ( strpos($content["all"],'{NEWSA:')===false ) ) {
$content["all"] = preg_replace('/\{NEWSA:(\d+)\}/e','get_newsa_articles($template_default["news"],$1,$db);',$content["all"]);
$content["all"] = preg_replace('/\{NEWSA:(\d+):(.*?)\}/e','get_newsa_articles($template_default["news"],$1,$db,"$2");',$content["all"]);
}
// -------------------------------------------------------------
?>
Code: Select all
<?php
// find all new articles in active(exluded current article), where categories is active, public, not hidden and not trashed
function get_newsa_articles($template_default, $max_cnt_links=0, $dbcon, $cat_id="") {
// find all new articles in active
$max_cnt_links = intval($max_cnt_links);
$limit = ($max_cnt_links) ? " LIMIT ".$max_cnt_links : "";
// START MOD
// check for params
if ($cat_id === "CURRENT") {
$cat_id = "'".(int)$GLOBALS['content']['cat_id']."'";
} else if ($cat_id == "") {
$cat_id = 'ac.acat_id';
} else {
$cat_id = "'".(int)$cat_id."'";
}
// fixed bug sql
$sql = "SELECT a.article_id, a.article_title, a.article_cid, UNIX_TIMESTAMP(a.article_tstamp) AS article_date
FROM ".DB_PREPEND."phpwcms_article a, ".DB_PREPEND."phpwcms_articlecat ac
WHERE a.article_cid = " . $cat_id . "
AND ac.acat_hidden = '0'
AND ac.acat_public = '1'
AND ac.acat_aktiv = '1'
AND ac.acat_trash = '0'
AND a.article_id != '" . (int)$GLOBALS['content']['article_id'] . "'
AND a.article_public = '1'
AND a.article_aktiv = '1'
AND a.article_deleted = '0'
AND a.article_begin < NOW()
AND a.article_end > NOW()
ORDER BY a.article_tstamp DESC".$limit;
// END MOD
// new articles list
$new_links = "";
$target = ($template_default["link_target"]) ? ' target="'.$template_default["link_target"].'"' : "";
if($result = mysql_query($sql, $dbcon)) {
$count_results = mysql_num_rows($result); $count = 0;
while ($row = mysql_fetch_row($result)) {
$count++;
if($template_default["link_length"] && strlen($row[1]) > $template_default["link_length"]) {
$article_title = substr($row[1], 0, $template_default["link_length"]).$template_default["cut_title_add"];
} else {
$article_title = $row[1];
}
if(trim($template_default["date_format"])) {
$article_title = international_date_format(
$template_default["date_language"],
$template_default["date_format"],
$row[3]).$article_title;
}
$new_links .= $template_default["link_before"].$template_default["link_symbol"];
$new_links .= '<a href="index.php?id='.$row[2].','.$row[0].',0,0,1,0"';
$new_links .= $target.">".html_specialchars($article_title)."</a>";
//try to remove possible unwanted after - if not enclosed before.link.after
if($new_links && !$template_default["link_before"] && $count < $count_results) {
$new_links .= $template_default["link_after"];
}
}
mysql_free_result($result);
}
//enclose whole
if($new_links) $new_links = $template_default["before"].$new_links.$template_default["after"];
return $new_links;
}
?>
Code: Select all
$phpwcms["allow_ext_init"] = 1; //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"] = 1; //allow including of custom external scripts at frontend rendering
usage:
{NEWSA:10} - show last 10 active articles(exluding current article) from all section where categories is active, public, not hidden and not trashed
{NEWSA:10:CURRENT} - show last 10 articles from current section(exluding current article)
{NEWSA:10:_ID_NUMBER_} - show last 10 articles from _ID_NUMBER_ section
good luck
the {newsa} not work for me 
i save the fils in
phpwcms_template/inc_script/frontend_render/newsa.php
and
phpwcms_template/inc_script/frontend_init/newsa.php
change the
$phpwcms["allow_ext_init"] = 1; //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"] = 1; //allow including of custom external scripts at frontend rendering
but in the frontend is only the {newsa} tag

i save the fils in
phpwcms_template/inc_script/frontend_render/newsa.php
and
phpwcms_template/inc_script/frontend_init/newsa.php
change the
$phpwcms["allow_ext_init"] = 1; //allow including of custom external scripts at frontend initialization
$phpwcms["allow_ext_render"] = 1; //allow including of custom external scripts at frontend rendering
but in the frontend is only the {newsa} tag

HELIOS ACHT http://www.helios-acht.de
I guess you need to use CAPITAL letters like:
{NEWSA:10}
{NEWSA:10}
http://www.studmed.dk Portal for doctors and medical students in Denmark
it doesnt work for mefrold wrote:I guess you need to use CAPITAL letters like:
{NEWSA:10}

HELIOS ACHT http://www.helios-acht.de
Re: {NEWSA} Tag
I try {NEWSA:10} {NEWSA:10:CURRENT} and {NEWSA:10:2}creep wrote: {NEWSA:10} - show last 10 active articles(exluding current article) from all section where categories is active, public, not hidden and not trashed
{NEWSA:10:CURRENT} - show last 10 articles from current section(exluding current article)
{NEWSA:10:_ID_NUMBER_} - show last 10 articles from _ID_NUMBER_ section
HELIOS ACHT http://www.helios-acht.de
-
- Posts: 6
- Joined: Sun 16. Jan 2005, 02:16
Sub-categories
Hi, I'm looking for a way to get last news from a categories, including its sub-categories... ?
If you have defined a keyword in each structure and substructure you will be able to show the latest edited, added or new articles.
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3