User Defined Tag Code Help for New User Please
Posted: Tue May 30, 2006 2:07 pm
As someone new to websites and CMS, I grabbed this code from the CMS MS Share Your Tags Here Page - author Elijah Lofgren. Thanks Elijah.
What It Does: It Outputs a list of the 10 most recently updated pages.
What I Did - Added a new User Defined Tag, pasted code (below), & submitted. Pasted tag on desired page {updatedpages}
Problem: The list comes up beautifully, and shows as hyperlinks, but when I click on the hyperlinks nothing happens. It won't open those pages.
___________________________________________________________________
Code:
$output = 'Most Recently Updated';
$output .= '';
global $gCms;
$db = &$gCms->db;
// Get list of 10 most recently updated pages excluding the home page
$q = "SELECT * FROM ".cms_db_prefix()."content WHERE type='content' AND default_content != 1 ORDER BY modified_date DESC LIMIT 10";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
while ($dbresult && $updated_page = $dbresult->FetchRow())
{
$output .= '';
$output .= ''.$updated_page['content_name'].'';
$output .= '
';
$output .= $updated_page['titleattribute'];
$output .= '
';
$output .= 'Modified: ' .$updated_page['modified_date'];
$output .= '';
}
$output .= '';
echo $output;
______________________________________________________
Am I missing a step, or is it perhaps, something I need to change/add in the code? If someone can take a look at the code and advise me, that would be fantastic!!
Any help much appreciated. Many Thanks.
What It Does: It Outputs a list of the 10 most recently updated pages.
What I Did - Added a new User Defined Tag, pasted code (below), & submitted. Pasted tag on desired page {updatedpages}
Problem: The list comes up beautifully, and shows as hyperlinks, but when I click on the hyperlinks nothing happens. It won't open those pages.
___________________________________________________________________
Code:
$output = 'Most Recently Updated';
$output .= '';
global $gCms;
$db = &$gCms->db;
// Get list of 10 most recently updated pages excluding the home page
$q = "SELECT * FROM ".cms_db_prefix()."content WHERE type='content' AND default_content != 1 ORDER BY modified_date DESC LIMIT 10";
$dbresult = $db->Execute( $q );
if( !$dbresult )
{
echo 'DB error: '. $db->ErrorMsg()."";
}
while ($dbresult && $updated_page = $dbresult->FetchRow())
{
$output .= '';
$output .= ''.$updated_page['content_name'].'';
$output .= '
';
$output .= $updated_page['titleattribute'];
$output .= '
';
$output .= 'Modified: ' .$updated_page['modified_date'];
$output .= '';
}
$output .= '';
echo $output;
______________________________________________________
Am I missing a step, or is it perhaps, something I need to change/add in the code? If someone can take a look at the code and advise me, that would be fantastic!!
Any help much appreciated. Many Thanks.