Help modifying this module code
Posted: Mon Oct 08, 2007 11:10 pm
Okey I want to get this module to display the author name and link back to their profile. Its a front page module used to display the X number latest mamblog posts. Iv been playing with it but Im only learning php at the moment and cant get it to work. As far as I can tell its only a matter of changing the query to look for the correct field then outputting it and concatenating it correctly.
[code:1]defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $database, $mosConfig_offset;
$count = $params->get( 'count', 5 );
$section = $params->get( 'section', 'Mamblog' );
$now = date( "Y-m-d H:i:«»s", time()+$mosConfig_offset*60*60 );
$query = "SELECT id FROM #__sections WHERE title='$section'";
$database->setQuery($query);
$section_id = $database->LoadResult();
$query = "SELECT id FROM #__menu WHERE link='index.php?option=com_mamblog'";
$database->setQuery($query);
$Itemid = $database->LoadResult();
$query = "SELECT id, title"
. "\n FROM #__content"
. "\n WHERE sectionid='$section_id'"
. "\n AND state=1"
. "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )"
. "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )"
. "\n ORDER BY created DESC"
. "\n LIMIT $count"
;
$database->setQuery($query);
$rows = $database->loadObjectList();
echo $database->getErrorMsg();
foreach($rows as $row) {
echo ''.$row->title.'
';
}
?>[/code:1]
[code:1]defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $database, $mosConfig_offset;
$count = $params->get( 'count', 5 );
$section = $params->get( 'section', 'Mamblog' );
$now = date( "Y-m-d H:i:«»s", time()+$mosConfig_offset*60*60 );
$query = "SELECT id FROM #__sections WHERE title='$section'";
$database->setQuery($query);
$section_id = $database->LoadResult();
$query = "SELECT id FROM #__menu WHERE link='index.php?option=com_mamblog'";
$database->setQuery($query);
$Itemid = $database->LoadResult();
$query = "SELECT id, title"
. "\n FROM #__content"
. "\n WHERE sectionid='$section_id'"
. "\n AND state=1"
. "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )"
. "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )"
. "\n ORDER BY created DESC"
. "\n LIMIT $count"
;
$database->setQuery($query);
$rows = $database->loadObjectList();
echo $database->getErrorMsg();
foreach($rows as $row) {
echo ''.$row->title.'
';
}
?>[/code:1]