<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SmileyLover Blog &#187; smarty dynamic column table</title>
	<atom:link href="http://blog.smileylover.com/tag/smarty-dynamic-column-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smileylover.com</link>
	<description>Sharing Knowledge and Resources</description>
	<lastBuildDate>Sun, 04 Apr 2010 18:32:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Dynamic Table With Smarty Engine Template</title>
		<link>http://blog.smileylover.com/dynamic-table-with-smarty-engine-template/</link>
		<comments>http://blog.smileylover.com/dynamic-table-with-smarty-engine-template/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:31:47 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Smarty]]></category>
		<category><![CDATA[smarty auto column table]]></category>
		<category><![CDATA[smarty dynamic column table]]></category>
		<category><![CDATA[smarty dynamic table]]></category>
		<category><![CDATA[smarty smart table]]></category>

		<guid isPermaLink="false">http://blog.smileylover.com/?p=246</guid>
		<description><![CDATA[Usually I make a dynamic table using PHP, but because it turned out that I handled the project requires use Smarty as template engine, then finally a direct table generated by Smarty. So PHP is only to issue a query from the database. Here is the template used to create a dynamic table on Smarty. [...]]]></description>
			<content:encoded><![CDATA[<p>Usually I make a dynamic table using PHP, but because it turned out that I handled the project requires use Smarty as template engine, then finally a direct table generated by Smarty. So PHP is only to issue a query from the database.</p>
<p>Here is the template used to create a dynamic table on Smarty.</p>
<pre>
&lt;table&gt;
	&lt;tr&gt;
	{assign var=\&quot;numCols\&quot; value=\&quot;6\&quot;}
	{assign var=\&quot;col\&quot; value=\&quot;0\&quot;}
	{section name=element loop=$data}
		{if $col == $numCols}
			&lt;/tr&gt;&lt;tr&gt;{assign var=\&quot;col\&quot; value=\&quot;0\&quot;}
		{/if}
		&lt;td&gt;{$data[element]}
		&lt;/td&gt; {assign var=\&quot;col\&quot; value=\&quot;`$col+1`\&quot;}
	{/section}
	{assign var=\&quot;remainder\&quot; value=\&quot;`$numCols-$col`\&quot;}
	{section name=emptyElement loop=$remainder}
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
	{/section}
	&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>NumCols is the number of columns you want, in the example is &#8220;6&#8243;, then when the column to be transformed into 7 new row. Hopefully this is useful for you. Happy coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smileylover.com/dynamic-table-with-smarty-engine-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

