Page 1 of 1

Get content (especially a summary text) from subpages?

Posted: Fri Dec 08, 2006 4:22 pm
by mpop
Hello there,

I've read a couple topics on this matter, and found a few interesting things, but nothing exactly meeting my needs.

I have category pages (without specific content : they're containers) and then subpages, so all in all it's a simple 2 level architecture. I need to have, as the « content » of a category page, an index of pages in the current category. The topics I've read pointed to Menu Manager > list_children.

list_children works fine. You can fetch the children's title and alternate title/description, which is great. But I'd like to be able to have formatted content and/or more content (like up to three paragraphs...  well, probably just one or two) as introductory text to the page's content.

All in all, I'd like something very similar the the News content element, with a summary and a main body (both being HTML-formatted), and then the ability to print the title and the summary for each child of a category page.

I've though of two ways :
1 - Introductory content is fecthed from the main content of the subpage ;
2 - Enhancing the Page content element, using something like PageBlocks

Question 1: is there a way to fetch the beginning of the main content of a subpage? I may be able to code it in PHP/MySQL, with a User Tag, especially if I don't need to open a specific connection to the DB. I'm not a developer, but just writing a mysql query should be ok. BUT, I might be able to get content, but it'll be HTML content, and if I cut after a given number of characters... well it'll be a mess. Uh oh...

Question 2: I haven't tested PageBlocks yet. Can I use it 1) to add a « summary » content block to my pages? and 2) is I can, how do I fetch the summary content for each child of a category page?


Sorry to ask that much... I've tried to give all the clues I have, but if you need any other information to help me, feel free to ask. ;)
Thanks in advance.

Florent

Re: Get content (especially a summary text) from subpages?

Posted: Fri Dec 08, 2006 4:31 pm
by calguy1000
Once you've got the child page's id, you can do it in a user tag with code something like this (untested)

global $gCms;
$contentops =& $gCms->GetContentOperations();
$content = $contentops->LoadContentByAlias( $childid );

and then explore within the $content object to get the text.  I'd also check out the contentAlias module or some such thing which is defined for just this purpose.

Re: Get content (especially a summary text) from subpages?

Posted: Fri Nov 30, 2007 9:28 am
by haapati
global $gCms;
$contentops =& $gCms->GetContentOperations();
$content = $contentops->LoadContentByAlias( $childid );
How do I get the additional content blocks with this?