Page 1 of 1

Articles with intro

Posted: Wed Jan 26, 2011 4:57 pm
by _luki
I've already created some sites with cmsms and know difrences between pages and news. But now, I really need to make all content as pages but some of them should have posibility to display short intro text. For better understanding I will show pages structure:

1. Start
2. Page2
3. Page4
3.1 Subpage 1
3.2 Subpage 2
3.3 Subpage 3
4. Page5

On Page4 I want to show short intro of all subpages, and I dont want to use News module for it, cause it will be a little bit akward. Subpages have normal content, its not news, in admin panel I want to sort them like pages not like news (i.e.by post date) etc.
Is there is some trick to do this in my way?

Re: Articles with intro

Posted: Wed Jan 26, 2011 6:09 pm
by Dr.CSS
You can pull page content into another using CGUtilities, IIRC, to pull subpage into parent page, as far as arranging them by date.published to be at top, you would have to do something with the menu template...

Re: Articles with intro

Posted: Wed Jan 26, 2011 6:12 pm
by Wishbone
Dr.CSS wrote:..using CGUtilities, IIRC..
Do you mean CGSimpleSmarty?

Re: Articles with intro

Posted: Wed Jan 26, 2011 6:14 pm
by Dr.CSS

Re: Articles with intro

Posted: Thu Jan 27, 2011 8:24 am
by _luki
I've installed cgcontentutils but have no idea how to use it for my purpose...

Re: Articles with intro

Posted: Thu Jan 27, 2011 6:32 pm
by Dr.CSS
I've never used it but just heard from another that CGSimpleSmarty works to pull content in...

Re: Articles with intro

Posted: Thu Jan 27, 2011 8:02 pm
by _luki
Ok, CGSimpleSmarty looks more promising. I will try to figure sth out.

Re: Articles with intro

Posted: Fri Jan 28, 2011 6:16 pm
by _luki
I've made it! :)
After installing CGSimpleSmarty i put in my template:

Code: Select all

{foreach from=$cgsimple->get_children('','',$children) item='child'}
    {if $child.show_in_menu}
        <h3>{$cgsimple->get_page_title($child.alias)}</h3>
         {cut_text text=$cgsimple->get_page_content($child.alias) lenght="110"}
        <a href="/{$child.alias}/">Read more</a>
    {/if}
{/foreach}
Tag {cut_text} is my tag, it's cutting text after x letters, code for it (put in User Defined Tag):

Code: Select all

$tresc =  $params['text'];
$ile = $params['lenght'];
    $licz = strlen($tresc);
    if ($licz>=$ile)
    {    
        $tnij = substr($tresc,0,$ile);
        $txt = $tnij."...";
    }
    else
    {$txt = $tresc;}
      echo $txt;