1 (edited by 2010-11-30 16:25:37)

Topic: [HACK] Date Header for archives

Name: Date header for archives
Author: NyNe
CuteNews Compatibility: 1.3.6 - no incompatibility reported yet
Description: look #1

2004
----
jan
feb
...

2003
----
jan
feb
...


Requirements:
this hack requires the auto archive hack (CN 1.4.0 and up has this option built in) AND the date header hack
Discussion Topic: archives by month
Instructions:

open show_archives.php

find:

                    echo"[url=]".date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp).", ([b]$count[/b])[/url]
";


replace with:

// Archive Date Header
if ($show_ah == true) {
$config_dateheaderformat = "Y";
if ($dateheader != date($config_dateheaderformat, $news_lines[0])) {
    $dateheader = date($config_dateheaderformat, $news_lines[0]);
if (!isset($template) || $template == "") { include ("$cutepath/data/Default_dh.tpl"); }
else { include ("$cutepath/data/".$template."_dh.tpl"); }
$template_active = str_replace("{dateheader}",$dateheader, $template_active);
echo $template_active;
if (!isset($template) || $template == "") { include ("$cutepath/data/Default.tpl"); }
else { include ("$cutepath/data/".$template.".tpl"); }
}}
// Archive Date Header
if (date("F",$first_timestamp) == date("F",$last_timestamp)) { $show_timestamp = date("F",$first_timestamp); } else { $show_timestamp = date("F",$first_timestamp)." - ".date("F",$last_timestamp); }
                 echo"[url=]$show_timestamp, ([b]$count[/b])[/url]
";

*NOTE* you must include $show_ah=TRUE; in your archive include code for this to work properly

look #2

jan 2004
feb 2004
...
jan 2003
feb2003
...

open show_archives.php

find:

.date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp).


replace with:

.date("F Y",$last_timestamp).

both of the above date formats use "F" which will display the full month name, if you'd like the abreviated month name change F to M
both of the above examples have the post count for the archive in them, if you'd like to remove them find and remove

, ([b]$count[/b])

credit to dateheader hack (LOL i hope someone notices this)

Posts: 1

Pages 1

You must login or register to post a reply

CutePHP Forums → Hacks & Tricks / FAQ → [HACK] Date Header for archives



The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.