Articles sorting by Entry Date?

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
DrubusCulubus
Posts: 47
Joined: Sat 10. Apr 2004, 12:53
Location: NL

Articles sorting by Entry Date?

Post by DrubusCulubus »

Hi Guys and Galls,

I have tried until I dropped ;) to sort articles by entrydate and I failed to do so.

What can I do to change the order in the NEWSCATID - replacement tag? I want to sort the articles by entry date and NOT the update - date...


Cheers!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

You are probably gonna have to mod the "hack" yourself or maybe someone else has ideas. The OP hasn't posted here for a couple months :(
DrubusCulubus
Posts: 47
Joined: Sat 10. Apr 2004, 12:53
Location: NL

Post by DrubusCulubus »

Well like I said, 'I've tried everything (I think ;) )' But since I am a nopenuts :D I can't seem to find the right file(s). Well I'll try again and again and again.......

Will let you know if I found the right file(s)...

Cheers!
DrubusCulubus
Posts: 47
Joined: Sat 10. Apr 2004, 12:53
Location: NL

Post by DrubusCulubus »

Finally I found it... For those who are interested in sorting news by entry date open /include/inc_front/front.func.inc.php

and go to the function:
// find all articles

change the last line into:

"ORDER BY article_begin DESC".$limit.";";

and voila all articles will be listed by article date nomather if you chnge something in the article.

Cheers!
Igor
Posts: 97
Joined: Fri 30. Apr 2004, 16:30
Location: The Netherlands
Contact:

Post by Igor »

Are you sure, this is the ONLY modification? It doesn't work on my site! :(
Igor
DrubusCulubus
Posts: 47
Joined: Sat 10. Apr 2004, 12:53
Location: NL

Post by DrubusCulubus »

Yes Igor,

That is only thing that I changed on my files/ However it DOES ONT work on the NEW:X replacement tage. But is DOES work on the NEWCATID replacement tage.

Cheers
http://qoala.nl - Nieuws om op te reageren!
Igor
Posts: 97
Joined: Fri 30. Apr 2004, 16:30
Location: The Netherlands
Contact:

Post by Igor »

Thanks DrubusCulubus,

I didn't know about this tag. I'll try!! :)

P.S. Mooie site!
Igor
Jakim José
Posts: 77
Joined: Fri 18. Feb 2005, 18:55
Location: Portugal/Aveiro

Post by Jakim José »

DrubusCulubus wrote:and go to the function:
// find all new articles

change the last line into:

Code: Select all

"ORDER BY article_begin DESC".$limit.";";
I have the version 1.2.3

Last line:

Code: Select all

$sql .=	"FROM ".DB_PREPEND."phpwcms_article WHERE ".$cat;
or (complete)...

Code: Select all

function get_new_articles($template_default, $max_cnt_links=0, $cat, $dbcon) {
	// find all new articles
	
	$cat = intval($cat);
	$max_cnt_links = intval($max_cnt_links);
	$limit = ($max_cnt_links) ? " LIMIT ".$max_cnt_links : "";
	$cat = ($cat) ? 'article_cid='.intval($cat).' AND ' : '';
	
	$sql  =	"SELECT article_id, article_title, article_cid, UNIX_TIMESTAMP(article_tstamp) AS article_date ";
	$sql .=	"FROM ".DB_PREPEND."phpwcms_article WHERE ".$cat;
IS THIS THE FINAL RESULT?

Code: Select all

function get_new_articles($template_default, $max_cnt_links=0, $cat, $dbcon) {
	// find all new articles
	
	$cat = intval($cat);
	$max_cnt_links = intval($max_cnt_links);
	$limit = ($max_cnt_links) ? " LIMIT ".$max_cnt_links : "";
	$cat = ($cat) ? 'article_cid='.intval($cat).' AND ' : '';
	
	$sql  =	"SELECT article_id, article_title, article_cid, UNIX_TIMESTAMP(article_tstamp) AS article_date ";
	"ORDER BY article_begin DESC".$limit.";";
It is not work!


openning /phpwcms_template/inc_script/frontend_init/noticias_init.php

appear...

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.";";
Is it here?

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_begin DESC".$limit.";";
It is not work!
Jakim José
Posts: 77
Joined: Fri 18. Feb 2005, 18:55
Location: Portugal/Aveiro

"x" letters on links

Post by Jakim José »

How to do to appear only "x" letters in article links?

Example:
Only 30 caracters

The original titles are:
- "Michael Jordan is on fire, but chicago bulls loose".
- "Chicago Bulls loose the championship on the last minute".

The desired result is:
2005/02/23 - Michael Jordan is on fire, but ...
2005/02/24 - Chicago Bulls loose the cham ...
Post Reply