Using "start date" for DATE... possible?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
rtilghman
Posts: 107
Joined: Tue 1. Mar 2005, 17:22

Using "start date" for DATE... possible?

Post by rtilghman »

So I need to be able to control the date that appears with my articles in order to control the publishing criteria... basically I need to be able to set the date that appears with the article so that I can create both past and future articles with the correct date on them.

The problem is that I cant set the "creation date" that's used by phpwcms. Is there any way to switch the DATE that's used in summary lists to start date instead of creation date? Is there a replacement tag I can use to call the start date instead of the creation date? Maybe DATE_START or something like that?

If I'm missing something and there is a way to control creation date from within an article please let me know.

Thanks,
Rick
lupo
Posts: 10
Joined: Mon 5. Dec 2005, 12:26
Location: Brugg, Switzerland

Post by lupo »

Hello Rick

I had the same problem to write articles of incidents that happened on a certain date, so I created a new RT called DATE_EVT (date of event) which uses the start date of the article (this is always in the past when I write the article, so I can use it).

The result you can see at http://www.fwbrugg.ch/wcms/index.php?berichte2005

My articlesummary list template looks like this:

Code: Select all

//-->
[SPACE]<hr>[/SPACE]
<div>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="150" valign="bottom">
  [IMAGE]<div><a href="{ARTICLELINK}">{IMAGE}</a></div>[/IMAGE]
  [CAPTION]<div align="center">{CAPTION}</div>[/CAPTION]
</td>
<td width="10">
  <img src="img/leer.gif" border="0" width="20" height="1" alt="">
</td>
<td width="98%" valign="top">
  [TITLE]<h5>{DATE_EVT:d. F Y:DE}</h5><h4 style="margin:0 0 5px 0;"><a href="{ARTICLELINK}">{TITLE}</a></h4>[/TITLE]
  [SUB]<h3 style="margin:0 0 5px 0;">{SUB}</h3>[/SUB]
  [SUMMARY]<p style="margin:0">{SUMMARY}</p>[/SUMMARY]
  [MORE]<a href="{ARTICLELINK}">{MORE}</a>[/MORE]
</td>
</tr>
</table>
</div>
I only had to patch the file ...\include\inc_front\front.func.inc.php (see lines with comment xxxxx rle):

function get_actcat_articles_data:

Code: Select all

			$data[$row["article_id"]] = array(
									"article_id"		=> $row["article_id"],
									"article_cid"		=> $row["article_cid"],
									"article_title"		=> $row["article_title"],
									"article_subtitle"	=> $row["article_subtitle"],
									"article_keyword"	=> $row["article_keyword"],
									"article_summary"	=> $row["article_summary"],
									"article_redirect"	=> $row["article_redirect"],
									"article_date"		=> $row["article_date"],
									"article_begin"		=> $row["article_begin"],         // xxxxx rle patch (added)
									"article_username"	=> $row["article_username"],
									"article_sort"		=> $row["article_sort"],
									"article_notitle"	=> $row["article_notitle"],
									"article_created"	=> $row["article_created"],
									"article_image"		=> unserialize($row["article_image"]),
									"article_timeout"	=> $row["article_cache"],
									"article_nosearch"	=> $row["article_nosearch"],
									"article_nositemap"	=> $row["article_nositemap"],
									"article_aliasid"	=> $row["article_aliasid"],
									"article_headerdata"=> $row["article_headerdata"],
									"article_morelink"	=> $row["article_morelink"]

function list_articles_summary:

Code: Select all

...					//rendering
					$tmpl = $tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ];
					$tmpl = render_cnt_template($tmpl, 'TITLE', html_specialchars($article_list[$key]["article_title"]));
					$tmpl = render_cnt_template($tmpl, 'SUB', html_specialchars($article_list[$key]["article_subtitle"]));
					$tmpl = render_cnt_template($tmpl, 'SUMMARY', $article_list[$key]["article_summary"]);
					$tmpl = render_cnt_template($tmpl, 'IMAGE', $thumb_img);
					$tmpl = render_cnt_template($tmpl, 'ZOOMIMAGE', $article_list[$key]["article_image"]["poplink"]);
					$tmpl = render_cnt_template($tmpl, 'CAPTION', nl2br(html_specialchars($article_list[$key]["article_image"]["caption"])));
					$tmpl = render_cnt_template($tmpl, 'ARTICLELINK', $article_link);
					$tmpl = render_cnt_template($tmpl, 'EDITOR', $article_list[$key]["article_username"]);
					$tmpl = render_cnt_template($tmpl, 'ARTICLEID', $article_list[$key]["article_id"]);					
					$tmpl = render_cnt_template($tmpl, 'MORE', $template_default["top_readmore_link"]);
					$tmpl = render_cnt_template($tmpl, 'BEFORE', '<!--before//-->');
					$tmpl = render_cnt_template($tmpl, 'AFTER', '<!--after//-->');
					$tmpl = render_cnt_date($tmpl, $article_list[$key]["article_date"]);
					$tmpl = render_cnt_date_evt($tmpl, strtotime($article_list[$key]["article_begin"]));   // xxxxx rle patch (added)
					if($temp_counter) {
and add the following function anywhere:

Code: Select all

function render_cnt_date_evt($text='', $date) {  	// xxxxx rle patched (function added)
	// render date by replacing placeholder tags by value
	//$language="EN", $format="Y/m/d", $date_now=0
	$text = preg_replace('/\{DATE_EVT:(.*?):(.*)\}/ie', 'international_date_format("$2","$1","'.$date.'")', $text);
	$text = preg_replace('/\{DATE_EVT:(.*?)\}/ie', 'date("$1",'.$date.')', $text);
	return $text;
}
I hope this is useful for you
Regards, Lupo
Pappnase

Post by Pappnase »

hello

but remember if you use this you need to update it verytime when you update the system :-(
lupo
Posts: 10
Joined: Mon 5. Dec 2005, 12:26
Location: Brugg, Switzerland

Post by lupo »

This is correct, but I needed a solution for my problem.
Of course, if it will be possible to set the creation date in a simple way in future, I will use the standard replacement tag and trash my one.
Lupo
rtilghman
Posts: 107
Joined: Tue 1. Mar 2005, 17:22

Post by rtilghman »

For some reason I never saw this reply... very cool man, perfectly suited for my task. I'm going to try and implement this tonight.

Pappnase, if I told you how many customizations I have in my installation (which I reuse/reinstall every time I use phpwcms) you would laugh. While I really like phpwcms there are just a bunch of small things that I needed to change to get it working the way I wanted... things like this Date change field, the controls used across the screens (I use buttons with "Edit" so the function is clear at a glance), etc.

Upside is that it works for my style, downside is that it's unlikely I'll be able to get off of 2.23 anytime soon. The changes are all commented, so I can get a full list with a global find. If and when user and group management is launched I will GLADLY recustomize that release... :)

Thanks for the help Lupo.

Best,
Rick
rtilghman
Posts: 107
Joined: Tue 1. Mar 2005, 17:22

Post by rtilghman »

Ended up working perfectly. To speak to some of the points aboute, I think all these variables should be added in the core build so they're available for summaries. Things like begin and end are very useful, and really there isn't any reason not to have them.

One note for anyone using teaser ex. Note that the teaser rt has its own rendering system for tags, so you'll need to replicate all these modifications within the RT code itself.

Best,
rt
InsightDubaidotcom
Posts: 2
Joined: Tue 14. Mar 2006, 22:50

Article Date

Post by InsightDubaidotcom »

I am having problem with article date appearing with every new article published. How can i disable the date from appearing and replace it with a bullet..

I want to achieve the look of "http://english.aljazeera.net"

Which file do i access in the backend to disable the date command.
User avatar
anthony.abraira
Posts: 99
Joined: Sun 11. Sep 2005, 07:42
Location: Mars Hill, NC
Contact:

Control date

Post by anthony.abraira »

Is there a way to extract only a part of the date. I would like to create a full page calendar...each article will have the date in which the event will occur and I want the date number to appear in a div for the sample.tmpl file in the 'list' directory

Does anybody know of a thread that addresses this?

thanks
aa 8)
"The trick is living without an answer."
johnn
Posts: 50
Joined: Mon 10. Apr 2006, 14:07

Post by johnn »

lupo wrote:Hello Rick

I had the same problem to write articles of incidents that happened on a certain date, so I created a new RT called DATE_EVT (date of event) which uses the start date of the article (this is always in the past when I write the article, so I can use it).

......
Hello, when I use your solution I get today's date in all the articles. Any idea why? :?
Post Reply