Hi everyone,
I use a tag displaying the 3 last updated pages on my website.
But in pages containing only a module, for example, the News module, any newly added News item does not trigger the tag to display this page in the last 3 updated pages.
Thanks for your help.
Here is the code:
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://www.cmsmadesimple.org
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_function_recently_updated($params, &$template)
{
$smarty = $template->smarty;
if(empty($params['number']))
{
$number = 10;
}
else
{
$number = $params['number'];
}
if(empty($params['leadin']))
{
$leadin = "Modified: ";
}
else
{
$leadin = $params['leadin'];
}
if(empty($params['showtitle']))
{
$showtitle='true';
}
else
{
$showtitle = $params['showtitle'];
}
$dateformat = isset($params['dateformat']) ? $params['dateformat'] : "d.m.y h:m" ;
$css_class = isset($params['css_class']) ? $params['css_class'] : "" ;
if (isset($params['css_class'])){
$output = '<div class="'.$css_class.'"><ul>';
}
else {
$output = '<ul>';
}
$gCms = cmsms();
$hm = $gCms->GetHierarchyManager();
$db = $gCms->GetDb();
// Get list of most recently updated pages excluding the home page
$q = "SELECT * FROM ".cms_db_prefix()."content WHERE (type='content' OR type='link')
AND default_content != 1 AND active = 1 AND show_in_menu = 1
ORDER BY modified_date DESC LIMIT ".((int)$number);
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."<br/>";
}
while ($dbresult && $updated_page = $dbresult->FetchRow())
{
$curnode = $hm->getNodeById($updated_page['content_id']);
$curcontent =& $curnode->GetContent();
$output .= '<li>';
$output .= '<a href="'.$curcontent->GetURL().'">'.$updated_page['content_name'].'</a>';
if ((FALSE == empty($updated_page['titleattribute'])) && ($showtitle=='true'))
{
$output .= '<br />';
$output .= $updated_page['titleattribute'];
}
$output .= '<br />';
$output .= $leadin;
$output .= date($dateformat,strtotime($updated_page['modified_date']));
$output .= '</li>';
}
$output .= '</ul>';
if (isset($params['css_class'])){
$output .= '</div>';
}
if( isset($params['assign']) ){
$smarty->assign(trim($params['assign']),$output);
return;
}
return $output;
}
function smarty_cms_help_function_recently_updated() {
echo lang('help_function_recently_updated');
}
function smarty_cms_about_function_recently_updated() {
?>
<p>Author: Olaf Noehring <http://www.team-noehring.de></p>
<p>Version: 1.1</p>
<p>Author: Elijah Lofgren <elijahlofgren@elijahlofgren.com></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
1.1: added new parameters: <br /> <leadin>. The contents of leadin will be shown left of the modified date. Default is <Modified:><br />
$showtitle='true' - if true, the titleattribute of the page will be shown if it exists (true|false)<br />
css_class<br />
dateformat - default is d.m.y h:m , use the format you whish (php format) <br />
</p>
<?php
}
?>
last updated pages tag in pages containing a module
Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Let us know here.
Jump to
- Official Boards
- ↳ README FIRST!!!
- ↳ Announcements
- ↳ General Discussion
- Support Boards
- ↳ CMSMS Core
- ↳ Modules/Add-Ons
- ↳ Help Wanted (commercial)
- ↳ Translations
- Community Boards
- ↳ Tips and Tricks
- ↳ CMS Show Off
- ↳ Layout and Design (CSS & HTML)
- ↳ Feature ideas
- ↳ Developers Discussion
- ↳ The Lounge
- International Discussions
- ↳ Czech/Slovak - Česky/Slovensky
- ↳ Danish - Dansk
- ↳ Dutch - Nederlands
- ↳ Aankondigingen
- ↳ Tips en Trucs
- ↳ Vertalingen & Documentatie
- ↳ Hulp gezocht (commercieel)
- ↳ Finnish - Suomi
- ↳ French - Français
- ↳ German - Deutsch
- ↳ BITTE ZUERST LESEN !!!
- ↳ Ankündigungen
- ↳ Installation und Einstellungen
- ↳ Module und Tags
- ↳ Smarty-Tipps und -Tricks
- ↳ Layout und Design
- ↳ Suchmaschinenoptimierung (SEO)
- ↳ HowTo's
- ↳ Übersetzungen
- ↳ Show Off
- ↳ Hilfe gesucht (kommerziell)
- ↳ Stammtisch
- ↳ Hungarian - Magyar
- ↳ Italian - Italiano
- ↳ Moduli/Plugins
- ↳ Lithuanian - Lietuviškai
- ↳ Darbo / bendradarbiavimo pasiūlymai ir paieška
- ↳ Persian / Farsi
- ↳ Polish - Polski
- ↳ Portuguese - Português
- ↳ Russian - русский
- ↳ Предложения и поиск РАБОТЫ
- ↳ Spanish - Español
- ↳ Swedish - Svenska
- Geekmoot Editions
- ↳ Geekmoot 2016
- ↳ Connections and Conversations
- ↳ Geekmoot 2015
- ↳ Geek Moot 2012
- ↳ Locked: Geek Moot 2010
- Old Forums
- ↳ [locked] CMSMS 2.0 Beta
- ↳ Module Developers
- ↳ Closed Issues
- ↳ [locked] Documentation0ld
- ↳ Suggestions, Modifications & Corrections
- ↳ [locked] CMSMS 1.11 Beta
- ↳ Closed Issues
- ↳ [locked] CMSMS 1.10 Beta
- ↳ Closed Issues
- ↳ [locked] CMSMS 2.2 Beta
- ↳ [locked] CMSMS MLE fork
- ↳ Modules/Addon patchs
- ↳ [locked] Quality Assurance
- ↳ [locked] Accessability and Usability
- ↳ [locked] Documentation
- ↳ Media and presentations about CMSMS
- ↳ [locked] Installation, Setup and Upgrade