[SOLVED] News Archives by Year/Month

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
tamsrud
Forum Members
Forum Members
Posts: 37
Joined: Mon Jun 06, 2011 6:25 am

Re: [SOLVED] News Archives by Year/Month

Post by tamsrud »

jlmcm wrote:
I just tried this, and it doesn't work (for me at least).
You must have two different news templates. One for the archive list, and one for showing the news with title and description.

In other words, first you must show the archive list with a code similar to:
{news summarytemplate='archive_list'}
Where archive_list is the template i described.

And then in the page news-archive show the full text with a code similar to:
{news summarytemplate="news_archive" start=$startpost pagelimit=$numposts}
Where news_archive is a template similar to the Sample template.
berg3n
New Member
New Member
Posts: 3
Joined: Mon Apr 16, 2012 2:14 pm

Re: [SOLVED] News Archives by Year/Month

Post by berg3n »

Works great, but you may need to change ?startpost to &startpost in the summary template to get it work
Calimer0

Re: News Archives by Year/Month

Post by Calimer0 »

sam_butler wrote: Yeah, I did that just now... UDT called 'news_archive_sidebar' with comments:
Might be useful to someone...
A small change in the code of sam_butler. This will make the UDT also work on Smarty v3 which is used in the newer CMSMS.

Code: Select all

$smarty_data = "{cms_selflink href='lbjaar}"; //this is the archive link
$smarty->_compile_source('temporary template', $smarty_data, $_compiled );
@ob_start();
$smarty->_eval('?>' . $_compiled);
$_contents = @ob_get_contents();
@ob_end_clean();
$archivelink = $_contents;
Is replaced by:

Code: Select all

$smarty_data = "{cms_selflink href='lbjaar'}"; //this is the archive link
$archivelink = $smarty->fetch('string:'.$smarty_data);
Post Reply

Return to “Developers Discussion”