Page 2 of 3
Posted: Mon 19. Jul 2004, 13:16
by rk
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
Posted: Wed 21. Jul 2004, 14:13
by nichri
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
I am not sure if I understand with your question.
Posted: Fri 23. Jul 2004, 00:43
by rk
nichri wrote:
I am not sure if I understand with your question.
You modify a hack for a function you need
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.
But that function already exist.
If you use {NEW:10} the result is the same, but it is a build in function
.
Posted: Fri 23. Jul 2004, 08:00
by nichri
rk wrote:
You modify a hack for a function you need
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.
But that function already exist.
If you use {NEW:10} the result is the same, but it is a build in function
.
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.
thnx
Posted: Thu 16. Sep 2004, 17:57
by isac
Hello!
I removed this lines
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;
}
because I don't want to show dates before links, and it work! But I want to know if I have to remove some more code lines?
Thanks,
ISac
Re: {NEWCATID}
Posted: Wed 23. Mar 2005, 16:12
by isac
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;
}
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"]);
}
replacement tag: {NEWCATID:max_count_links:cid}
oops, are you there?
Can you make this with highlighting the currently selected position in the list by using a different style.
Posted: Thu 24. Mar 2005, 03:04
by ndtoan13
nichri, what is the difference of your tag {NEWALL:..} with default tag {NEW:number} of phpwcms!
Posted: Thu 24. Mar 2005, 11:40
by isac
ndtoan13 wrote:nichri, what is the difference of your tag {NEWALL:..} with default tag {NEW:number} of phpwcms!
there is no diference. nichri build {NEWALL:..} because he didn't know {NEW:}already exists wich as the same funtion.
new improve ?
Posted: Sat 26. Mar 2005, 21:53
by snezko
is it possible change the second variable in this tag by something more dynamic ? for example CURRENT how is it in menu ?
because than i need only one implementation of tag in the template for all the web.
Posted: Mon 28. Mar 2005, 18:55
by brans
Hi you all, could all of you, who develop future hacks please quickly read through our guidelines ?
--...--/index.php/topic,4.0.html
please specially mind the frontend_render thing!
Space between date and title
Posted: Sun 15. May 2005, 13:48
by Jakim José
How to create a space ( ) between date and article title?
Posted: Sun 15. May 2005, 13:51
by Jakim José
How to place last articles only in homepage. Not in template.
Where I place {NEWCATID
5}, for example?
pictures?
Posted: Tue 21. Jun 2005, 04:54
by plushett
This is very handy, but what about stepping a bit closer to having title with the picture from the article?
Posted: Sat 25. Jun 2005, 00:41
by Chrismuc
Hi,
i installed it and it works but there is the space missing inbetween the date
and the headline. how can i change it?
it look like that:
2005/06/18blablabla
2005/06/18testetstets
Posted: Sun 26. Jun 2005, 13:33
by isac
in conf.template_default.inc.php
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>';
$template_default["news"]["date_before"] = '<span class="datelink">';
$template_default["news"]["date_after"] = ' - </span>';