Code: Select all
{NEW:max_count_links}
Shows headline and date of last edited article
Example: {NEW:5} - shows the last edited articles with headline and date
Code: Select all
{NEW:max_count_links}
Shows headline and date of last edited article
Example: {NEW:5} - shows the last edited articles with headline and date
I am not sure if I understand with your question.rk wrote:What did you think about
Code: Select all
{NEW:max_count_links} Shows headline and date of last edited article Example: {NEW:5} - shows the last edited articles with headline and date
You modify a hack for a function you neednichri wrote: I am not sure if I understand with your question.
Code: Select all
use it like {NEWALL:no_of_latest_articles_to_be_shown} i.e. {NEWALL:10} gets the latest 10 articles from the whole site.
I didn't know that; I started using phpwcms just a couple of weeks ago and I am still in seek of the rest of its power - obviously I need more reading in the forums.rk wrote: You modify a hack for a function you needBut that function already exist.Code: Select all
use it like {NEWALL:no_of_latest_articles_to_be_shown} i.e. {NEWALL:10} gets the latest 10 articles from the whole site.
If you use {NEW:10} the result is the same, but it is a build in function .
Code: Select all
if(trim($template_default["date_format"])) {
$article_title = international_date_format(
$template_default["date_language"],
$template_default["date_format"],
$row[3]).$article_title;
}
oops, are you there?oops wrote:headlines from category
Code: Select all
function get_new_articles_from_catid($template_default, $max_cnt_links=0, $cid=0, $dbcon) { // find all new articles $max_cnt_links = intval($max_cnt_links); $limit = ($max_cnt_links) ? " LIMIT ".$max_cnt_links : ""; $sql = "SELECT article_id, article_title, article_cid, UNIX_TIMESTAMP(article_tstamp) AS article_date ". "FROM ".DB_PREPEND."phpwcms_article WHERE ". "article_cid='$cid' AND article_public=1 AND article_aktiv=1 AND article_deleted=0 AND ". "article_begin < NOW() AND article_end > NOW() ". "ORDER BY article_tstamp DESC".$limit.";"; // 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; }
replacement tag: {NEWCATID:max_count_links:cid}Code: Select all
if( ! ( strpos($content["all"],'{NEWCATID:')===false ) ) { $content["all"] = preg_replace('/\{NEWCATID:(\d+):(\d+)\}/e','get_new_articles_from_catid($template_default["news"],$1,$2,$db);',$content["all"]); }
Code: Select all
// new articles
$template_default["news"]["before"] = "<div class=\"news\">";
$template_default["news"]["after"] = "</div>";
$template_default["news"]["link_before"] = "";
$template_default["news"]["link_after"] = "<br>";
$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"] = "EN"; // DE=German, IT=Italian, FR=French, ES = Spanish, DA = Danish, NO = Norwegian
$template_default["news"]["date_format"] = "Y/m/d"; //if empty -> no Date
$template_default["news"]["date_before"] = '<span class="datelink">';
$template_default["news"]["date_after"] = ' - </span>';