[SOLVED] Is there a way to add blog style excerpts of daughter pages to a parant

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
richardkean
Forum Members
Forum Members
Posts: 17
Joined: Mon Oct 20, 2008 5:27 pm

[SOLVED] Is there a way to add blog style excerpts of daughter pages to a parant

Post by richardkean »

Has any one written this kind of thing?

thanks!
-Richard
Last edited by richardkean on Fri Dec 05, 2008 4:14 pm, edited 1 time in total.
Zoorlat

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by Zoorlat »

Yes.  :)

Take a look at the Content Dump Plugin (http://dev.cmsmadesimple.org/projects/contentdump). It takes a bit of thinking to figure out how it works, but once you get it you will have a very useful and flexible content-tool in your hands.

/Z
nhaack

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by nhaack »

Hi there,

indeed, when I read the questions, I thought... "that's a task for content_dump" - thanks Zoorlat for recommending my plug-in ;D

You can build it all with the same template and just adding the code to the content-blocks, however, I recommend creating an extra template for your index page. In this template, put the plug-in call and you are ready to style your index.

In your parent template do something like:

Code: Select all

{content_dump start_id=$content_id}

{foreach from=$dump item=dump}
<div class="blog_entry">
  <h2>{$dump->content->title}</h2>
  <span class="date">{$dump->created->date}</span>
  <p>{$dump->content->data}</p>
</div>
{/foreach}
Voilá a veeeery simple blog is born.

Check out the wiki page here: http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Tags/content_dump for a list of all options, parameters and data fields.

Together with some smarty, you can build blogs that are very close to the functionality of a real blogging system like wordpress (including pagination). Since it is page based, you can easily combine it with such modules as rating, comments (soon with trackbacks) or whatever combination you can think of :)

I hope this could give you a little kick-start. Please, do not hesitate to ask for help on implementation. :)

Best
Nils
richardkean
Forum Members
Forum Members
Posts: 17
Joined: Mon Oct 20, 2008 5:27 pm

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by richardkean »

Wow!  this is great!  thanks so much.  i'll see where I can get with it and I'll certainly ask if I have any questions. Thanks!
-Richard
richardkean
Forum Members
Forum Members
Posts: 17
Joined: Mon Oct 20, 2008 5:27 pm

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by richardkean »

I'm working away on this and have a couple of questions now.

I've added the code {content_dump} to my template and the following to my page:

{content_dump start_id=$content_id}

{foreach from=$dump item=dump }

  {$dump->content->title}
  {$dump->created->date}
  content->alias}.htm>See: {$dump->content->title}


{/foreach}

Here is what it looks like:
http://www.usa-explained.net/portal/ind ... automobile

This displays what I ask but it also displays the parent page.  is there a way to get it to start at the first daughter page?  if I add "+1" to the $content_id i get the next page but it will stop there and not give me the rest of the daughter pages.

Here is what this looks like:
http://www.usa-explained.net/portal/ind ... e=business

another question:
The Alias command gives me what I place in the Alias field.  What command can i use to get the actual page url? do I need to use allias and add the page url manually in each page options section??

thanks! great plugin, I'll definitely get alot of millage out of this once I figure it out.

-Richard
richardkean
Forum Members
Forum Members
Posts: 17
Joined: Mon Oct 20, 2008 5:27 pm

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by richardkean »

I fixed the link issue this way:

{content_dump start_id=$content_id}

{foreach from=$dump item=dump }

  {$dump->content->title}
  {$dump->created->date}
  content->alias}>See: {$dump->content->title}


{/foreach}

works fine...
nhaack

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by nhaack »

Hi Richard,

nice to hear that it works for you.
The Alias command gives me what I place in the Alias field.  What command can i use to get the actual page url? do I need to use alias and add the page url manually in each page options section?
Concerning the alias and the actual page URL, you have to manually build it (like you finally did):

e.g.

Code: Select all


<a href="{$dump->content->alias}.htm">click here</a>

or

<a href="index.php?page={$dump->content->alias}">click here</a>

or

<a href="index.php?page={$dump->content->id">click here</a>

It works with URL rewriting (pretty urls), however, when working with hierarchical pretty urls, you need to be cautious not to create different access possibilities for a single page.

But as you see, you do not get a real URL from content_dump. I am not sure, probably you can combine content_dump with the self-link (something like the following - not tested)

Code: Select all


{foreach from=$dump item=dump }
<div class="blog_entry">
  <h2>{$dump->content->title}</h2>
  <span class="date">{$dump->created->date}</span>
  <p>{cms_selflink page=$dump->content->alias text="See: {$dump->content->title}"}</p>
</div>
{/foreach}


A little SEO hint: when manually building the links, enrich them with some extra information in the title. This will better "explain" the link to search engines. It will not do any magic, but SEO starts with little things ;). You already use your page title (which contains your page's most important keyword(s) I guess) in the anchor text, that's already much better than a "read more" or "see details". The cms_selflink should work fine.

Code: Select all


<a href="{$dump->content->alias}.htm" title="USA Explained: {$dump->content->title}">See: {$dump->content->title}</a>

About the other question:
This displays what I ask but it also displays the parent page.  is there a way to get it to start at the first daughter page?  if I add "+1" to the $content_id i get the next page but it will stop there and not give me the rest of the daughter pages.
$content_id is used in the parameter start_id so that the plug-in only looks in the branch beginning with the current page. I never tried $content_id+1... a very interesting idea... however, when the next ID is not a daughter page, you'll index the wrong branch. Just exclude the starting page with the exclude parameter so you plug-in call looks like this:

Code: Select all


{content_dump start_id=$content_id exclude="$content_id"}



Oh, and if I may give you a little idea:

Add an extra content block to your page called "page summary" and use this to provide little teaser texts for the single pages. I suggest you copy the template so that you have two different templates - articles and index. And let's make it not WYSIWYG (no TinyMCE). So we only enter the pure text (not required, but I consider this cleaner).

Code: Select all


{content block="page_summary" wysiwyg=false}

If you do not want to show the teaser_text (e.g. as these little abstracts magazines have on top of their articles), just assign it to variable and it won't appear on the page itself and bother you.

Code: Select all


{content block="page_summary" wysiwyg=false assign=page_summary_var}



If you combine all that, you can do this with content dump in the very end (not tested - but should work):

Code: Select all


{content_dump block_name="page_summary" start_id=$content_id}

{foreach from=$dump item=dump }
<div class="blog_entry">
  <h3>{$dump->content->title}</h3>
  <span class="date">{$dump->created->date}</span>
  <p>{$dump->content->data}<br />
        {cms_selflink page=$dump->content->alias text="See: {$dump->content->title}"}
  </p>
</div>
{/foreach}
Enjoy the plug-in and let me know if you need some additional hints or inspiration :).

Best
Nils
Last edited by nhaack on Thu Dec 04, 2008 10:01 pm, edited 1 time in total.
richardkean
Forum Members
Forum Members
Posts: 17
Joined: Mon Oct 20, 2008 5:27 pm

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by richardkean »

OK,  so here it is in action!!

http://www.usa-explained.net/portal/ind ... ge=medical

Thanks so much!

I created the extra block and article template you suggested and this is my code for the index template::

{content_dump block_name="page_summary" start_id=$content_id exclude="$content_id"}

{foreach from=$dump item=dump }

  {$dump->content->title}
  {$dump->created->date}
  {$dump->content->data}
content->alias}>See more: {$dump->content->title}


{/foreach}


Now I can get to dressing it up a little...
nhaack

Re: Is there a way to add blog style excerpts of daughter pages to a parant page?

Post by nhaack »

Glad it worked for you.

Please add [Solved] to the title of your initial post :)

Best
Nils
Post Reply

Return to “Modules/Add-Ons”