Tag Content_Dump



For Version 0.8.x:

Get it here: [1]

There is no required parameter, if no parameter is set, all sites content will be shown. The default usage of the tag will not compile any smarty nor will it filter it out.

Just placing {content_dump} will already do a lot for you as you can make a lot with the output in conjunction with smarty. However, just placing the tag into a page/template won’t show anything. The tag will run and you’ll get to know if all works out fine - when you see nothing.

Now add some smarty to the soup and you’ll start to see something.

Ok, the simplest method to get to the data is by addressing the class array directly. Something like {$dump[0]->content->title} would give you the first pages title.

So having {content_dump} {$dump[0]->content->title} in your template/content will output the first sites pages’ title (which will most likely be “home”).


Yes, “fancy” I hear you say. But do something like this in your template and see all page titles:

  {foreach from=$dump item=dump}

But title isn’t the only thing you can use. Depending on what parameters you use, you can get information about the parent page or about the creator and last editor of a page. {content_dump this_only=$content_id users=true} allows you to access the username, first and last name as well as the e-Mail and ID of the mentioned users.

Placing Written by: {$dump[0]->created->by->firstname} {$dump[0]->created->by->firstname} into your regular page template, automatically posts the articles original author into your page.

So you see, you can get extra data from and for very specific elements if you want to.

So, let’s do something more sophisticated. How about getting all titles of the pages that are below a specific page. Then do something like this:

 {content_dump start_id=”17”}

Hey, but we didn’t want the startpage to be included! Just add exclude=”17” to your tag and it’s gone. Oh, page 25 shall also be excluded? No problem, let’s make it exclude=”17,25”. And getting the creation date would be nice. No Problem. At the end, the tag call would look like this:

 {content_dump start_id=”17” exclude=”17,25”}
 {foreach from=$dump item=dump}

You get too many results? Just want to see 5? Let’s add limit_count=5 to the tag. And we are done. If we want to see the second 5 entries, we just shift the start position with limit_start=6.

 {content_dump start_id=”17” exclude=”17,25” limit_start=6 limit_count=5}

Want to see the latest pages? Try the sorting mechanics. You can sort by 9 options (check the parameters description). To display the newest 10 entries of the site area below page 17 we can do something like this:

 {content_dump start_id=”17” exclude=”17” limit_count=10 first_sort=”created” first_sort_order=”down”}

Now let’s add links and content to our entries and give it some style. We do not need to change anything with the tag. We just wrap some html (XML, JS or CSS or whatever you are thinking of) around the smarty in the content/template and that’s it.

 {content_dump start_id=”17” exclude=”17,25” block_name=”summary”}
 <h1>Product overview:</h1>
  {foreach from=$dump item=dump}
    <span class=”date”>{$dump->created->date}</span>
   <a href=”{$dump->content->alias}.htm”>See: {$dump->content->title}</a>

You might want to get specific content blocks from a page, just list the blog names with the parameters extensions and you can have them.

 {content_dump start_id=”17” exclude=”17,25” extensions="summary,image,some_other_block"}

To access the additional content elements, use something like:


Available data elements

Generally, you can access these elements:

 $dump [ n ] -> item = Counter for items in current list (integer)
 $dump [ n ] -> content -> id
 $dump [ n ] -> content -> alias
 $dump [ n ] -> content -> title
 $dump [ n ] -> content -> show
 $dump [ n ] -> content -> active
 $dump [ n ] -> content -> data
 $dump [ n ] -> parents -> id
 $dump [ n ] -> parents -> alias
 $dump [ n ] -> parents -> title
 $dump [ n ] -> created -> date
 $dump [ n ] -> created -> by -> username
 $dump [ n ] -> created -> by -> last_name
 $dump [ n ] -> created -> by -> first_name
 $dump [ n ] -> created -> by -> email
 $dump [ n ] -> modified -> date
 $dump [ n ] -> modified -> by -> username
 $dump [ n ] -> modified -> by -> last_name
 $dump [ n ] -> modified -> by -> first_name
 $dump [ n ] -> modified -> by -> email
 $dump [ n ] -> extension (will be 1 if any extension contains something, default: 0)

And for each extension you have named, you will get an equally named class element below $dump [ n ] -> extensions (note the "s" at the end).


 $dump [ n ] -> extensions -> summary -> data
 $dump [ n ] -> extensions -> summary -> length

Usable Parameters (all optional)

Basic Parameters for shaping the collection

Assign the output variable name

assign can be used to define the outputs name to something else than $dump[n]. $dump[n] will be kept as the default for downward compatibility.

 {content_dump assign="my_var_name"}

Now you can access your date like this: $my_var_name[0]->content->alias. This makes it much easier to use the plug-in several times in a single template.

Selecting the main content-block

block_name can be used to define the content block you want to use as the $dump[n]->content->data element. Per default, it will be "content_en", the page standard content block. If the block you want to show is {content block="summary"} in your source page's template, you would call it like in the following example:

 {content_dump block_name="summary"}
Where should the dump begin (root ID of collection)?

start_id can be used to define a starting point for your content collection. If not specified, it will begin with id "-1" and thus include all matching pages from all pages. A nice trick to use the tag in several pages based on the same template and limit the tag to this site area is to set start_id=$content_id. This way, you use the viewed page's id as the initial page and ignore all other content folders.

 {content_dump start_id=16}
Just show the data of a specific element

this_only is a parameter that will limit the result to this specific ID.

 {content_dump this_only=55}
How can I paginate content_dump?

page can be used to generate a page based view. Value is page number. It will basically move the view you have on the results by the number of items specified in limit_count. It alters the limit_start by adding limit_count to it, each time an increasing page is selected. Let's say you have limit_start=0 and limit_count=5, page=2 will alter limit_start to be 6.

Usage of this parameter will provide some extra smarty data elements. $pager_info->current, $pager_info->max and $pager_info->size. Representing the currently selected page, the maximum page available and the page size. Use smarty and this data to build easy and complex pagers alike.

 {content_dump limit_count=5 page=2}
Show also inactive pages or only inactive pages.

active can be used to control how the ACTIVE flag of pages should be interpreted. "force" shows all pages regardless of status. "active" show active pages only (default). "inactive" show inactive pages only.

 {content_dump active="force"}
Show in menu - what about that?

show_in_menu can be used to control how the SHOW_in_menu flag of pages should be interpreted. "force" shows all pages regardless of status. "show" show pages set to "Show in Menu" only (default). "hidden" show pages that are set to "Don't Show in Menu" only.

 {content_dump show_in_menu="hidden"}

Filter, Search and Prefix Handling

Filter for specific content (e.g. check if data fields contain the word "world" / sort of a simple search)

filter can be used to limit the results to pages which contain specific words or phrases in a specified content block or to exlcude such items. Use boolean logic. e.g. filter="-hello" to exclude items that contain the word "hello" in any of their content->data or extension->item_name->data elements or filter="world" to limit the results to those items that contain the word "world" in the standard content block: content_en (default).

 {content_dump filter="world -hello"} 

Use this MySQL Syntact to add FULLTEXT index to your content_props table:

Attention: To use this specific feature, you have alter your content_props table in the DB manually. If you have no clue what you are doing there and what that means, you might want to consider not to use this specific feature.

 ALTER TABLE cms_content_props ADD FULLTEXT (content)

The filtering is based on the block specified with the parameter "block_name". If you want to filter another block for a match, state the block here. You can still output your standard block by stating it via the "extensions" parameter. E.g.

 {content_dump filter="world -hello" block_name="the_other_block_name" extensions="content_en"} 
Exclude or limit (filter) the output to pages with matching alias prefix

prefix can be used to state the prefix or prefixes that should be considered for exluding from the collection or that should be the only pages in the collection. Several prefix are seperated by comma. E.g. {content_dump prefix="private_,special_"}

 {content_dump prefix="prefix1,prefix2"} 
How should the prefix or list of prefix(es) be handled?

prefix_mode Prefix-mode is used to controll the handling of the prefix(es). "force", "neutral" and "hide" are the available values. Standard mode is neutral that will disregard any available prefix. Forced mode only shows pages with one of the stated prefixes. Hide will exlude pages with the prefix from the items returned.

 {content_dump prefix_mode="hide"} 
How can I limit the output to specific hierarchy levels (e.g. depth) ?

depth is used to control the what hierarchy levels should be considered for output. It takes two integer values seperated by comma (e.g. depth="-1,3"}. The first value defines the starting hierarchy. -1 = start with content_dump, n = start with specific hierarchy level [0 and 1 both return first level].

The second value defines the number of additional levels added to the collection. 0 = no depth, siblings of page specified with first depth value are returned (if not excluded otherwise). n = number of additional level relative to the level specified with first depth value.

Both values must be used!

 {content_dump depth="-1,3"} 

Specifically exclude items from the collection

Skip the first X items (offset).

limit_start will allow you to do that. State the number of the item you would like your output to begin with. Default is 0

 {content_dump limit_start=5}
Limit the output to a specific number of items.

limit_count can be used to limit the output to a specific number. In combination with page, it will define the size of a page.

 {content_dump limit_count=10}
Exclude single items from the list

exclude allows you to remove specific pages from the results. It takes any number of content IDs seperated by comma. Especially when forcing content_dump to compile smarty in found content-blocks, you can use this tag to break endless recursions or for any other reason where you want specific pages not to appear.

 {content_dump exclude="13,23,53,12,32"}

Add more data to the item - Request more item info

Get more information about parent pages

parents can be used to request more information about the parent pages (alias and title). Possible values are true or false. Using this parameters allows you to use the data element $dump[n]->parents->alias or $dump[n]->parents->title. The data element $dump[n]->parents->id will be provided in any case. Per default it is deactivated.

 {content_dump parents=true}
Get more information about users that wrote/edited the content

users can be used to request more information about the users who last edited and created the content. Possible values are true or false. Per default $dump[n]->created->by and $dump[n]->modified->by will only return the user ID. If set to true, the mentioned class elements will be expanded by detailed user info (first-, last- and user name).

 {content_dump users=true}
I want to use more content-blocks from the single pages

extensions is your choice then. It takes a comma seperated list of content_blocks. If any of them (for an item) features content, $dump[n]->extension will be "1", other wise it will be "0" (default). This can be used to check for availability of "more" data. Each content_block will be added as a class below $dump[n]->extensions. E.g. {content block="more_text"} will be available as $dump[n]->extensions->more_text->data together with $dump[n]->extensions->more_text->length. Ideally, your content block names do not feature special charcacters and not " " or "-", use "_" instead.

 {content_dump extensions="summary,image,other_block_name"}

Process data from items

Change the date/time format to someting else

dateformat can be used to format the date output of content_dump. Check http://de.php.net/strftime for more ifo on the date format options. Per default it is set to "%A, %e %B %Y" (e.g. Sat, 20 September 2008). It is used for the two time stamps $dump[n]->created->date and $dump[n]->modified->date that are always returned with each item.

 {content_dump dateformat="%A, %e %B %Y"}
Change the date/time locale to someting else

cdlocale can be used to specify a specific locale for your output. E.g. your page is danish and your site/server is set to this locale - but for the generation of valid RSS you might need the US date/time locale.

 {content_dump cd_locale="en-us"}
I want smarty from content-fields to be compiled, or removed

do_smarty controls how smarty data that may be retrieved should be handled. There are three options "compile, neutral and strip". "compile" compiles smarty data in in the pages found. "neutral" prints out the smarty code as regular text and is the default setting. "strip" deletes all smarty code from your page (well, everything between { and }).

However, be carefull not to construct a query that would have to compile itself, this will result in an out of memory error due to endless recursion. If you use this tag only once with the compile parameter in your site, no problem, it prevents itself from being rendered. But if you have another occurences of this tag that would include the page that is calling the currently processed tag with compile="true", you should exclude all of these pages (content dump does not check for the compile parameter of other occurences of the tag).

If that called tag would feature other content blocks.. then again all would work nice. Just do not construct something with content_dump that is somewhere in the chain of events compiling itself.

 {content_dump do_smarty="compile"}
Remove HTML from content elements so I can safely truncate the data

html is a parameter that allows you to remove any HTML, JavaScript and CSS from a content-block. "strip" and "neutral" are the available options. "Neutral" will display the content as it is (after processing do_smarty settings) and is the default setting. "Strip" will remove the mentioned elements.

 {content_dump html="neutral"}

Sort items

Primary sorting of data elements

first_sort sorts the found content by one of the following values: id, alias, title, created, modified, owner, hierarchy (default), id_hierarchy, lasteditor, active, show (show in menu). For time based (like newest contents) use created, for last updated lists use modified (both need to be reversed with sort_order). Hint: Sorting by owner or lasteditor takes place by ID, not name!

 {content_dump first_sort="owner"}
Set the direction of primary sorting

first_sort_order can be used to reverse the sorting filter. "up" and "down" are the available options, whereas "up" (A before B or yesterday before today) is the default direction.

 {content_dump first_sort_order="up"}
Secondary sorting of data elements

second_sort sorts the found content by one of the following values: id, alias, title, created, modified, owner, hierarchy, id_hierarchy, lasteditor, active, show (show in menu). For time based (like newest contents) use created, for last updated lists use modified (both need to be reversed with sort_order). Hint: Sorting by owner or lasteditor takes place by ID, not name!

 {content_dump first_sort="owner" second_sort="created"}
Set the direction of secondary sorting

second_sort_order can be used to reverse the sorting filter. "up" and "down" are the available options, whereas "up" (A before B or yesterday before today) is the default direction.

 {content_dump first_sort_order="up"} 

Useful Smarty logic for content_dump pagination

Prepare template for paging

{assign var=page_call value=$smarty.get.show_page} {if $page_call == ""}{assign var=page_call value=1}{/if}

This will listen for URL parameter called show_page and its value. If no parameter found, create is and assign value 1. Use $page_call as the value of the page parameter {...page=$page_call...}

"newer" "older" pager

 {if $page_call > 1 }
  <a href="blog.htm?show_page={$pager_info->current-1}">newer articles</a>
 {if $pager_info->max > $page_call}
  <a href="blog.htm?show_page={$pager_info->current+1}">older articles</a>

Page number list pager

 {section name="i" start=1 loop=$pager_info->max+1 step=1}
  <a href="blog.htm?show_page={$smarty.section.i.index}">{$smarty.section.i.index}</a>

Some copy & go snippets

Building Links

Using: cms_selflink

There are different ways to create your desired links. A safe way is to do something like:

 {cms_selflink page=$dump->content->alias text=$dump->content->title}

As you will automatically get the right URL generated by the CMS.

Using: hand-crafted ;)

Alternatively, you can manually build your links like:

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


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

However, this second is probably a bad choice if you have a page hierarchy that is spreading over more than 2 Levels as Content-Dump only knows the current and at max the parents ID and hierarchy position. If you stay within the limits, you can do something like:

 <a href="YOUR_ALIAS/{$dump->parents->alias}/{$dump->content->alias}">read more</a>

A little SEO hint: "read more" is actually a bad example. Your links anchor text should ideally describe the target, just as you should have a title attribute in your tag. The following should give you a hint.

 <a href="{$dump->content->alias}" title="{$dump->content->title}">More about: {$dump->content->title}</a>

Walk through all available elements

 {content_dump ... }
 {foreach from=$dump item=dump}

10 newest pages list from the full site

 {content_dump limit_count=10 first_sort="created" first_sort_order="down"}
 {foreach from=$dump item=dump}
  <.li>{cms_selflink page=`$dump->content->alias` text=`$dump->content->title`}<./li>

10 last modified pages list from the full site

 {content_dump limit_count=10 first_sort="modified" first_sort_dir="down"}
 {foreach from=$dump item=dump}
  <.li>{cms_selflink page=$dump->content->alias text="{$dump->content->title}"}<./li>

Display basic blog style summary listing of pages below

Remove dots "." from markup - used here to prevent HTML from being interpreted. This snippet can also be used as a starting point to content based galleries.

 {content_dump block_name="page_summary" start_id=$content_id}
 {foreach from=$dump item=dump }
 <.div class="entry">
  <.span class="date">{$dump->created->date}<./span>
  <.p>{$dump->content->data}<.br />
  {cms_selflink page=$dump->content->alias text="See: {$dump->content->title}"}

Use the extensions parameter


Using the extension parameter allows to build rich artist portfolios (audio,video,photo) with complex meta-data. Use this to broadcast page summaries made of several fields (e.g. a page of each business unit in a company has a page where they fill in numbers) to the front page (and use smarty to create wicked calculation).

Let's assume we have two templates "unit-profile" and "home".

"Unit-profile" would contain these additional content blocks (and is situated in the "Business Unit" part of the site beginning with id 57):

 {content block="profit" oneline=true}
 {content block="summary"}

Call the plug-in

In the "home" template, we use content dump like that:

 {content_dump block_name="summary" extensions="profit" start_id=57}
 {foreach from=$dump item=dump}
   <a href="{$dump->content->alias}">see Unit Page</a>    

If you like you can also call more extension:

 {content_dump block_name="summary" extensions="profit,another_field,and_another" start_id=57}
 {foreach from=$dump item=dump}
   <a href="{$dump->content->alias}">see Unit Page</a>    

Use smarty to do extra stuff with the results

If you want to fancy it up and print out a profit sum at the end, add a variable to the thing. Something like the following should work out:

 {assign var=$profit_sum value = 0}
 {content_dump block_name="summary" extensions="profit" start_id=57}
 {foreach from=$dump item=dump}
     {assign var=$profit_sum value = $profit_sum + $dump->extensions->profit->data}
   <a href="{$dump->content->alias}">see Unit Page</a>    
 The Profit Sum of all Business-Units is: {$profit_sum}

Only show read more links if extension contains data

You might have a situation where a summary just isn't always enough and a full single page often too much. Short messages don't need direct links....? No problem (you still link them with your menu - right ;)).

The "extension" flag tells us whether the blocks named in the extensions-parameter contain data. It would look somehow like that:

 {content_dump block_name="summary" extensions="long_version" start_id=57}
 {foreach from=$dump item=dump}
   {if $dump->extension == 1}
     <a href="{$dump->content->alias}">Read the full story</a>  
     This was a short article.

Display additional user information (build a "page status")

Want to give a little info who edited and created the page at what time? Place this directly into your article template. This_only will restrict the result to the single page and users=true will request more user information.

 {content_dump this_only=$content_id users=true}
 {foreach from=$dump item=dump}
   Originally written by: {$dump->created->by->first_name} - {$dump->created->by->email}
   Originally published at: {$dump->created->date}
   {if $dump->created->date != $dump->modified->date } - {$dump->modified->by->email}
     Modified by: {$dump->modified->by->first_name}
     Modified at: {$dump->modified->date}


You have read all that and still have no clue whether this is for you or not? You think it could be the solution to your problems but your are buzzled by the pure amount of parameters?

Draw a plan

Honestly, get paper and pencils and draw a rough sketch of your content tree and think what elements you want to place where. Put a list of the parameters next to it and cross away those pages from the tree that would be eliminated by the plug-in parameters. Soon you'll understand how it works.

Ask author for help

Join the forum and ask for help. Please state your questions alongside the template for outputting the dump and the original plug-in call from the template. This will make it much easier. Please do not contact me by mail directly... the spam filters on the address here uses strong spam filter so as a "stranger" you might get caught and I'll never see your question. Additionally, others might have the same questions and want to know about the solution.


Currently no known bugs in 0.7


The filter parameter is very strict and more of an experimental feature. It also requires a minor modification of the database. 0.7.1 will provide improved handling.

This page in: English - Deutsch - Español - Français - Italiano - Lietuvių - Nederlands - Norsk - Polski - Česky - Русский - Svenska - Tiếng Việt - عربي - 日本語 简体中文

User Handbook/Admin Panel/Tags/content dump


A2 Hosting