Get content (especially a summary text) from subpages?

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
mpop

Get content (especially a summary text) from subpages?

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
haapati
Forum Members
Forum Members
Posts: 20
Joined: Sun Sep 10, 2006 4:14 pm

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

Post by haapati »

global $gCms;
$contentops =& $gCms->GetContentOperations();
$content = $contentops->LoadContentByAlias( $childid );
How do I get the additional content blocks with this?
Locked

Return to “CMSMS Core”