Page 3 of 4

Re: [SOLVED] News Archives by Year/Month

Posted: Fri Dec 05, 2008 1:47 pm
by blast2007
oliverseddon wrote: Any chance of you re-posting the link to the patch? It seems to be a dead link now and I could really do with having this functionality.
Hi oliverseddon,

after this great forge restying, it seems that all old posts (feature request and bug tracking) were deleted.

Anyway you can check this post.

regards
blast

Re: [SOLVED] News Archives by Year/Month

Posted: Fri Dec 05, 2008 3:05 pm
by oliverseddon
Thanks for the link, unfortunately I don't understand any of what is being said and can't fathom what I need to change to solve it. Any ideas?



Thanks

Re: [SOLVED] News Archives by Year/Month

Posted: Fri Dec 05, 2008 6:40 pm
by blast2007
oliverseddon wrote: Thanks for the link, unfortunately I don't understand any of what is being said and can't fathom what I need to change to solve it. Any ideas?



Thanks
Sorry oliverseddon for that,

you have to download patch file (news.period.mpg), then rename to .zip and uncompress it.

After that you can apply patch to distribution files.

Hope this helps
regards
blast

Re: [SOLVED] News Archives by Year/Month

Posted: Fri Dec 05, 2008 7:28 pm
by calguy1000

Re: [SOLVED] News Archives by Year/Month

Posted: Fri Dec 05, 2008 8:01 pm
by blast2007
calguy1000 wrote: Please remember this post:
http://forum.cmsmadesimple.org/index.php/topic,28132.0.html
I've read that post, ...but it seems that you simply ignore previous messages.

I can't still understand why this patch can't be merged in the official module.

The patch is ready from feb 2008. There are less than 10 lines of code, so it's not so difficult to check them and to merge in SVN.

I hope a "sponsor" will need this feature because in that case it will be ready very soon.

Re: [SOLVED] News Archives by Year/Month

Posted: Sat Dec 06, 2008 4:00 pm
by oliverseddon
Thanks. I've now got the news.period.diff file. How do I run the update? I can't seem to find any details on the process anywhere.



Thanks
Oliver

Re: [SOLVED] News Archives by Year/Month

Posted: Sun Dec 07, 2008 9:36 pm
by blast2007
oliverseddon wrote: Thanks. I've now got the news.period.diff file. How do I run the update? I can't seem to find any details on the process anywhere.
You can proceed in three ways:

- by hand (editing each file listed. A "+" in patch file stands for "add this line", a "-" for delete this line)
- using win program like tortoiseSVN
- using linux "patch" command

regards
blast

Re: [SOLVED] News Archives by Year/Month

Posted: Mon Dec 08, 2008 1:41 am
by oliverseddon
Thanks for all your help. I have finally managed to get it up and running, I'm on a Mac so tried the patch command in Terminal but it kept giving me errors so I just ended up manually altering the files. I'm running CMS 1.4.1 on the particular site I've been working on and noticed that some of the line numbers that needed altering were slightly different, so I don't know if that was causing the conflict when I was trying to run the Patch command.

Take a look at the result if your interested:

http://www.addmaster.co.uk


Thanks again.

P.S
This is a really beneficial feature, why hasn't it been added to the News module as standard yet?  ???

Re: [SOLVED] News Archives by Year/Month

Posted: Tue Jan 27, 2009 2:31 pm
by Ziggywigged
oliverseddon wrote: This is a really beneficial feature, why hasn't it been added to the News module as standard yet?  ???
Just want to add my request to have this feature added to the news module.

Re: [SOLVED] News Archives by Year/Month

Posted: Tue Jan 27, 2009 6:00 pm
by blast2007
Said that I won't start flame...

...I think you should give it up.

Read this signature from our "CMS GURU - 2nd Tier Support" and you can understand why it's impossible to add this feature:
...
"I don't ignore everybody.... Just the ones I chose to.
and.. I accept it: I DO have an attitude problem."

Re: [SOLVED] News Archives by Year/Month

Posted: Wed Jan 28, 2009 1:54 pm
by Ziggywigged
Any CMSMS devs out there want to give an estimate of what it would cost to implement this feature as part of the core news module? Maybe I can get a client to sponsor the change.

Re: [SOLVED] News Archives by Year/Month

Posted: Mon Mar 16, 2009 9:34 pm
by benchfrooser
calguy1000 wrote: Please remember this post:
http://forum.cmsmadesimple.org/index.php/topic,28132.0.html
Your link doesn´t answer why not implement this new function.

Re: [SOLVED] News Archives by Year/Month

Posted: Tue Mar 24, 2009 9:46 pm
by Dr.CSS
If you would like to sponsor(pay for) this addition to the news module I'm sure a quick email or request in the modules forge page could make it happen, if you wonder why calguy hasn't added it yet it may be because atm he is working on paying projects...

Re: [SOLVED] News Archives by Year/Month

Posted: Tue Jul 12, 2011 7:56 am
by tamsrud
I was in the need for a archive function as described in this post. With a different approch i got it working without any modifications of the news module.

Insted I use the fact that you can filter what news that are displayed based on post id.

I used the default news summary function to provide the month/year list like this:
2010
• November (9)
• December (16)
2011
• January (2)
It is created with the following news summary template:

Code: Select all

<!-- Start Categorylist -->
{foreach from=$cats item=node}
{if $node.count > 0}<a href="/news-archive/?category={$node.news_category_name}">{$node.news_category_name}</a>
{else}<span>{$node.news_category_name}</span>{/if}&nbsp;
{/foreach}
<hr/>
<!-- Start News Archive -->
<ul class="list2">
{assign var="month_count" value=0}
{assign var="post_count" value=0}
{assign var="startpost" value=0}
{foreach from=$items item=entry}
{if $entry->postdate}
  {assign var="post_year" value=$entry->postdate|date_format:"%Y"}
  {assign var="post_month" value=$entry->postdate|date_format:"%m"}
  {if $post_month != $lastpost_month && $lastpost_month}
<li>
<a href="{cms_selflink href='news-archive'}?startpost={$startpost}&numposts={$month_count}&pagetitle={$lastpost_monthname}-{$lastpost_year}">
{$lastpost_monthname}</a> ({$month_count})</li>
    {assign var="month_count" value=1}
    {assign var="startpost" value=$post_count}
  {else}
    {math equation="x + 1" x=$month_count assign="month_count"}  
  {/if}
  {if $post_year != $lastpost_year && $lastpost_year}</ul></li>{/if}
  {if $post_year != $lastpost_year}
    <li>{$post_year}<ul>
  {/if}
  {assign var="lastpost_year" value=$post_year}
  {assign var="lastpost_month" value=$post_month}
  {assign var="lastpost_monthname" value=$entry->postdate|date_format:"%B"}
  {math equation="x + 1" x=$post_count assign="post_count"}
{/if}
{/foreach}
<li>
<a href="{cms_selflink href='news-archive'}?startpost={$startpost}&numposts={$month_count}&pagetitle={$lastpost_monthname}-{$lastpost_year}">
{$lastpost_monthname}</a> ({$month_count})</li>
</ul></li></ul>
<!-- End News Archive -->
To display the correct news it is requred to have a page with alias news-archive . In this page, disable WYSIWYG and paste the folowing code:

Code: Select all

{news_archive_setup}
<h1>{$pagetitle}</h1>
{if $category}{news category=$category}
{else}{news start=$startpost pagelimit=$numposts}
{/if}
And finaly add a UDT called news_archive_setup:

Code: Select all

global $gCms;
global $smarty;

if (isset($_GET['category']) || $_GET['category'] != "") {
$category=$_GET['category'];
$smarty->assign('category', $category);
}
if (!isset($_GET['startpost']) || $_GET['startpost'] == "") {
$startpost=0;
} else {
$startpost=$_GET['startpost'];
}
if (!isset($_GET['numposts']) || $_GET['numposts'] == "") {
$numposts=20;
} else {
$numposts=$_GET['numposts'];
}
if (isset($_GET['pagetitle']) || $_GET['pagetitle'] != "") {
$pagetitle= htmlentities("Newsarchive - ".$_GET['pagetitle']);
} elseif (isset($_GET['category']) || $_GET['category'] != "") {
$pagetitle= htmlentities("Newsarchive - ".$_GET['category']);
} else {
$pagetitle="Newsarchive";
}

$smarty->assign('startpost', $startpost);
$smarty->assign('numposts', $numposts);
$smarty->assign('pagetitle', $pagetitle);

Re: [SOLVED] News Archives by Year/Month

Posted: Wed Aug 03, 2011 8:37 pm
by jlmcm
I was in the need for a archive function as described in this post. With a different approch i got it working without any modifications of the news module.
I just tried this, and it doesn't work (for me at least). It produces a nice, populated list of links, but they don't point to the stories. They point to new pages with more lists on them, and the links in those lists don't point anywhere.