User Defined Tag Code Help for New User Please

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
arcadia

User Defined Tag Code Help for New User Please

Post by arcadia »

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.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: User Defined Tag Code Help for New User Please

Post by Elijah Lofgren »

arcadia wrote: 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.
You're welcome.  :)
arcadia wrote: 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.

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.
It was a problem with my code.  ;)
I had only used this tag with URLs like /parent/child (See http://wiki.cmsmadesimple.org/index.php ... retty_URLs for how to get them).

I've updated the code to work whether or not pretty URLs are enabled.
See: http://wiki.cmsmadesimple.org/index.php ... ly_updated

Let me know how it goes,

Elijah
Last edited by Anonymous on Wed May 31, 2006 3:41 am, edited 1 time in total.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
arcadia

Re: User Defined Tag Code Help for New User Please

Post by arcadia »

Thanks Elijah. I tried the new code, but get this error message -

Fatal error: Call to undefined function: gethierarchymanager() in /home/aiatea/public_html/lib/content.functions.php(978) : eval()'d code on line 4
(aiatea refers to my site below)

The latest 10 articles do not appear at all on the page. The site  is a 3 column template, but when I add the user defined tag it shows just as one page with no images or columns.

I have removed the tag now for the moment, but this is my site -
All Info About Tea & Coffee Lifestyle. It is part of a group of sites, so not sure if that impacts on how things work.

Thanks again.  I really appreciate your help.
Russ
Power Poster
Power Poster
Posts: 813
Joined: Fri Nov 25, 2005 5:02 pm

Re: User Defined Tag Code Help for New User Please

Post by Russ »

arcadia which template are you using? I think the dissappearing coloum maybe just an unclosed ? On the other hand... I just tried to validate you web site home page and it doesn't, so I'd look at that first. Trying to solve these sorts of problems on a non-validated page is impossible.

Russ
arcadia

Re: User Defined Tag Code Help for New User Please

Post by arcadia »

Hi Russ
Its CMS Made Simple 0.11.2.The funny thing is I have used other User Defined Tags both with no problem at all.

Thanks for taking a look. I appreciate your help.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: User Defined Tag Code Help for New User Please

Post by Ted »

The hierarchy manager code wasn't introduced until 0.12, so that's why you're getting the errors.  I'm not sure why the code above isn't working for you, though.  It looks like it should.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: User Defined Tag Code Help for New User Please

Post by Elijah Lofgren »

Ted wrote: The hierarchy manager code wasn't introduced until 0.12, so that's why you're getting the errors.  I'm not sure why the code above isn't working for you, though.  It looks like it should.
Maybe because it uses a page "hierarchy_path". That may not be in the old 0.11.2 version.

@arcadia:
I would upgrade to CMSMS 0.13 so that this will work.  ;)
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Locked

Return to “CMSMS Core”