Greatvai,
a me funziona perfettamente sulla 4.5.2
Faccio copia-incolla dal file che ho sul server
Code:
<?php
// $Id: mod_latestnews.php,v 1.14 2003/12/17 22:22:39 eddieajau Exp $
/**
* Latest News Module
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.14 $
* modifiaction by John Lyons info@mambosolutions.com / added read more link+ intro text
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $mosConfig_offset;
$count = @$params->count ? intval( $params->count ) : 5;
$catid = @$params->catid ? intval( $params->catid ) : 0;
$now = date( "Y-m-d H:i:s", time()+$mosConfig_offset*60*60 );
// set up the query, the '#__' is converted into the table prefix
// set all content items:
// - not on the front page :: mask=0
// - pubslished :: state=1
// - checked out :: checked_out = 0
// - not in a menu :: sectionid > 0
// - between the publish_up and publish_down dates
$query = "SELECT f.content_id, a.id, a.title, a.sectionid, a.catid, a.introtext"
. "\nFROM #__content AS a"
. "\nLEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
. "\nWHERE (f.content_id IS NULL AND a.state='1' AND a.checked_out='0' AND a.sectionid > '0')"
. "\n AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '$now')"
. "\n AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '$now')"
. ($catid ? "\n AND a.catid='$catid'" : '')
. "\nORDER BY a.created DESC LIMIT $count";
// initialise the query in the $database connector
// this translates the '#__' prefix into the real database prefix
$database->setQuery( $query );
// retrieve the list of returned records as an array of objects
$rows = $database->loadObjectList();
// cycle through the returned rows displaying them in a table
// with links to the content item
// escaping in and out of php is now permitted
// added Itemid linking to url
?>
<table cellpadding="1" cellspacing="1" border="0">
<?php foreach ($rows as $row) {
// limit output to 16 characters and strip tags hack *added by John Lyons 2003
$row->introtext = strip_tags($row->introtext); //get rid of ALL tags
$str_array = explode(' ', ($row->introtext), 17);
$size = count($str_array);
while ($size > 16)
{
$size--;
array_pop($str_array);
}
$outstr = implode(' ', $str_array);
//END limit output to 16 characters and strip tags
?>
<tr>
<td valign="top"><img src="<?php echo $mosConfig_live_site;?>/images/M_images/arrow.png" alt="" /></td>
<td><a href="<?php echo sefRelToAbs("index.php?option=content&task=view&id=$row->id"); ?>"><?php echo $row->title ?></a><br><?php echo $outstr; ?><br><a href="<?php echo sefRelToAbs("index.php?option=content&task=view&id=$row->id"); ?>"><b>Read More...</b></a><br></td>
</tr>
<?php
}
?>
</table>