<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" 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/" > <channel><title>Comments on: Smarty templates: Creating smarty custom functions</title> <atom:link href="http://viralpatel.net/blogs/2009/06/smarty-templates-creating-smarty-custom-functions.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2009/06/smarty-templates-creating-smarty-custom-functions.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Wed, 08 Feb 2012 10:36:26 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Sandesh Magdum</title><link>http://viralpatel.net/blogs/2009/06/smarty-templates-creating-smarty-custom-functions.html/comment-page-1#comment-14543</link> <dc:creator>Sandesh Magdum</dc:creator> <pubDate>Tue, 12 Apr 2011 08:14:06 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1355#comment-14543</guid> <description>Use above function like: </description> <content:encoded><![CDATA[<p>Use above function like:</p> ]]></content:encoded> </item> <item><title>By: Sandesh Magdum</title><link>http://viralpatel.net/blogs/2009/06/smarty-templates-creating-smarty-custom-functions.html/comment-page-1#comment-14542</link> <dc:creator>Sandesh Magdum</dc:creator> <pubDate>Tue, 12 Apr 2011 08:11:31 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1355#comment-14542</guid> <description>I want to add meta tag&#039;s  keywords and description attributes dynamically.First I done it within include.inc.php and assigned the variables in template files.But after creating smarty function i can use it like:function smarty_function_metatag($params, &amp;$smarty) { if(!isset($params[&#039;tmpl&#039;])) { $smarty-&gt;trigger_error(&quot;metatag: parameter &#039;tmpl&#039; missing&quot;); return; } else if(!isset($params[&#039;ttype&#039;])) { $smarty-&gt;trigger_error(&quot;metatag: parameter &#039;ttype&#039; missing&quot;); return; } $pfile = $params[&#039;tmpl&#039;]; switch ($params[&#039;ttype&#039;]) { case &#039;keywords&#039;: $array_keywords = array( &#039;login&#039;=&gt;&#039;Login,Extentia&#039;, &#039;faq&#039;=&gt;&#039;FAQ,Extentia&#039;, &#039;news&#039;=&gt;&#039;News,Extentia&#039;, &#039;contact&#039;=&gt;&#039;Contact Us,Extentia&#039;, &#039;careers&#039;=&gt;&#039;Careers,Extentia&#039;, &#039;forgot&#039;=&gt;&#039;Forgot Password,Extentia&#039; ); if (array_key_exists($pfile, $array_keywords)) { return $array_keywords[$pfile]; } break; case &#039;description&#039;: $array_description = array( &#039;login&#039;=&gt;&#039;Login to Extentia,Extentia&#039;, &#039;faq&#039;=&gt;&#039;FAQ about Extentia,Extentia&#039;, &#039;news&#039;=&gt;&#039;News about Extentia,Extentia&#039;, &#039;contact&#039;=&gt;&#039;Contact Us,Extentia&#039;, &#039;careers&#039;=&gt;&#039;Careers at Extentia,Extentia&#039;, &#039;forgot&#039;=&gt;&#039;Forgot Password,Extentia&#039;, ); if (array_key_exists($pfile, $array_description)) { return $array_description[$pfile]; } break; } }Your post helped me a lot.Thank you Viral Patel.</description> <content:encoded><![CDATA[<p>I want to add meta tag&#8217;s  keywords and description attributes dynamically.</p><p>First I done it within include.inc.php and assigned the variables in template files.</p><p>But after creating smarty function i can use it like:</p><p>function smarty_function_metatag($params, &amp;$smarty) {</p><p> if(!isset($params['tmpl'])) {<br /> $smarty-&gt;trigger_error(&#8220;metatag: parameter &#8216;tmpl&#8217; missing&#8221;);<br /> return;<br /> }<br /> else if(!isset($params['ttype'])) {<br /> $smarty-&gt;trigger_error(&#8220;metatag: parameter &#8216;ttype&#8217; missing&#8221;);<br /> return;<br /> }</p><p> $pfile = $params['tmpl'];</p><p> switch ($params['ttype']) {</p><p> case &#8216;keywords&#8217;:</p><p> $array_keywords = array(<br /> &#8216;login&#8217;=&gt;&#8217;Login,Extentia&#8217;,<br /> &#8216;faq&#8217;=&gt;&#8217;FAQ,Extentia&#8217;,<br /> &#8216;news&#8217;=&gt;&#8217;News,Extentia&#8217;,<br /> &#8216;contact&#8217;=&gt;&#8217;Contact Us,Extentia&#8217;,<br /> &#8216;careers&#8217;=&gt;&#8217;Careers,Extentia&#8217;,<br /> &#8216;forgot&#8217;=&gt;&#8217;Forgot Password,Extentia&#8217;<br /> );</p><p> if (array_key_exists($pfile, $array_keywords)) {<br /> return $array_keywords[$pfile];<br /> }</p><p> break;</p><p> case &#8216;description&#8217;:</p><p> $array_description = array(<br /> &#8216;login&#8217;=&gt;&#8217;Login to Extentia,Extentia&#8217;,<br /> &#8216;faq&#8217;=&gt;&#8217;FAQ about Extentia,Extentia&#8217;,<br /> &#8216;news&#8217;=&gt;&#8217;News about Extentia,Extentia&#8217;,<br /> &#8216;contact&#8217;=&gt;&#8217;Contact Us,Extentia&#8217;,<br /> &#8216;careers&#8217;=&gt;&#8217;Careers at Extentia,Extentia&#8217;,<br /> &#8216;forgot&#8217;=&gt;&#8217;Forgot Password,Extentia&#8217;,<br /> );</p><p> if (array_key_exists($pfile, $array_description)) {<br /> return $array_description[$pfile];<br /> }</p><p> break;<br /> }<br /> }</p><p>Your post helped me a lot.</p><p>Thank you Viral Patel.</p> ]]></content:encoded> </item> <item><title>By: Php</title><link>http://viralpatel.net/blogs/2009/06/smarty-templates-creating-smarty-custom-functions.html/comment-page-1#comment-12702</link> <dc:creator>Php</dc:creator> <pubDate>Mon, 21 Jun 2010 07:09:18 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=1355#comment-12702</guid> <description>Very good one. Cool :-)</description> <content:encoded><![CDATA[<p>Very good one. Cool <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 10:21:47 -->
