CodeIgniter Forums

Full Version: Templating system question?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
I am planning on using CI for a new project, and have been flicking through the documentation etc. to get an idea on implementation. I am quite interested in the template parser class as it seems to have the potential to provide some useful functionality. I have a few questions that are not covered by the documentation however...

The basic template example as in the docs follows...

Code:
<html>
<head>
<title>{blog_title}</title>
</head>
<body>

<h3>{blog_heading}</h3>

{blog_entries}
<h5>{title}</h5>
<p>{body}</p>
{/blog_entries}
&lt;/body&gt;
&lt;/html&gt;

If I do not provide an array for {blog_entries} in the merged array, will it still display one instance of the contents of the block, or will it hide it entirely?

Also, is the template system capable of recursion? I mean does the following work (if I pass the class a multidimensional array, allowing me to have any number of level_2's within each level_1 block?

Code:
{level_1}
<h3>{title}</h3>
{level_2}
<h4>{title}</h4>
{/level_2}
{/level_1}

Any answers on these question would be greatly appreciated!

Thanks in advance.

El Forum

[eluser]Thorpe Obazee[/eluser]
I haven't actually tried CI's template parser. However, you may want to look at Colin's CI Template library