<?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>M4d3L Blog&#039;s&#187; Zend Framework</title>
	<atom:link href="http://www.m4d3l-network.com/category/developpement/php/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.m4d3l-network.com</link>
	<description>Sky is NOT the limit!</description>
	<lastBuildDate>Sat, 30 Jul 2011 19:30:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<div id='fb-root'></div>
					<script type='text/javascript'>
						window.fbAsyncInit = function()
						{
							FB.init({appId: 178184625541198, status: true, cookie: true, xfbml: true});
						};
						(function()
						{
							var e = document.createElement('script'); e.async = true;
							e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
							document.getElementById('fb-root').appendChild(e);
						}());
					</script>	
						<item>
		<title>How to use Flickr with Zend Framework?</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 22:23:53 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[service api]]></category>
		<category><![CDATA[zend cache]]></category>
		<category><![CDATA[Zend_Service_Flickr]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=454</guid>
		<description><![CDATA[Zend Framework have a good API to play with Flickr Service. You will find it in the service API of Zend Framework. First of all, we take the tag we want to search on the Flickr database. 1 $flirktag = &#34;php, mysql&#34; After, we dont want to call each time the Flickr database so we [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Zend Framework have a good API to play with Flickr Service. You will find it in the <a href="http://framework.zend.com/manual/en/zend.service.html">service </a>API of Zend Framework.<br />
<span id="more-454"></span><br />
First of all, we take the tag we want to search on the Flickr database.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$flirktag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;php, mysql&quot;</span></pre></td></tr></table></div>

<p>After, we dont want to call each time the Flickr database so we will settup a cache of 10 minutes.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$frontendOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'lifetime'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">600</span><span style="color: #339933;">,</span>                   <span style="color: #666666; font-style: italic;">// cache lifetime of 10 minute</span>
    <span style="color: #0000ff;">'automatic_serialization'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span>  <span style="color: #666666; font-style: italic;">// this is the default anyways</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$backendOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_dir'</span> <span style="color: #339933;">=&gt;</span> MYAPP_PATH_DATA<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> Zend_Cache<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Output'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'File'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$frontendOptions</span><span style="color: #339933;">,</span> <span style="color: #000088;">$backendOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>We check first if it already have cache for the query we want. If no cache we execute the query like this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;flickr&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$flickr</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Service_Flickr<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'###YOUR#ID###'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> 
        <span style="color: #0000ff;">'page'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'tag_mode'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'extras'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'license, date_upload, date_taken, owner_name, icon_server'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$flickr_results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$flickr</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tagSearch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After, if we have some result, we can show data like this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;flickr section&quot;&gt;&lt;ul class=&quot;gallery&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$flickr_result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flickr</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$substring</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.jpg&quot;</span> or <span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.gif&quot;</span> or <span style="color: #000088;">$substring</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;.png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flickr</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a rel=&quot;lightbox-tour&quot; href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Medium</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; title=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;img class=&quot;thumb&quot; src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$flickr_result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Square</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$flickrPlugin</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/ul&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Finally, we save the cache for future request than print the result.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>38
39
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickrPlugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;flickr&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flirktag</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flickrPlugin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This is a very simple exemple of what we can do with the Zend_Service_Flickr component.</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=454&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autocomplete field with Zend Framework and Dojo</title>
		<link>http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 00:20:32 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[dojox]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[FilteringSelect]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[QueryReadStore]]></category>
		<category><![CDATA[Zend_Form]]></category>
		<category><![CDATA[zf]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=416</guid>
		<description><![CDATA[In this exemple, we will se how to create an autocomplete field with Zend Framework and Dojo in the ZF MVC environment. We will use the QueryReadStore Dojo component to load new data when input value change. Initialize Dojo in your layout In the header of your layout, you must be able to load Dojo [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/' rel='bookmark' title='Zend_Form : How to remove decorator from hidden field.'>Zend_Form : How to remove decorator from hidden field.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>In this exemple, we will se how to create an autocomplete field with Zend Framework and Dojo in the ZF MVC environment. We will use the QueryReadStore Dojo component to load new data when input value change.</p>
<p><span id="more-416"></span></p>
<h3>Initialize Dojo in your layout</h3>
<p>In the header of your layout, you must be able to load Dojo in page that need it loaded only to not overload other page that doesn&#8217;t have Javascript in it.</p>
<p>Exemple :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctype</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'XHTML1_STRICT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;en&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getActionName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">headTitle</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getControllerName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendStylesheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">theme_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/css/style.css'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">headLink</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'favicon'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'href'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'/images/favicon.ico'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'PREPEND'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">headMeta</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'expires'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Wed, 26 Feb 1997 08:21:57 GMT'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pragma'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'no-cache'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Type'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'text/html;charset=UTF-8'</span><span style="color: #009900;">&#41;</span>                 
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendHttpEquiv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cache-Control'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'no-cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>                 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocalPath</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">BaseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/plugins/dojo/dojo.js'</span><span style="color: #009900;">&#41;</span>
         <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addStyleSheetModule</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dijit.themes.tundra'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dojo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/head&gt;</pre></td></tr></table></div>

<p>This code will add all javascript library needed and css style in the head of your page.</p>
<h3>Setup the form and choose the good element</h3>
<p>In your main view, you create the form and add the good element for your autocomplete input.</p>
<p>Dojo provide 2 type of Element : FilteringSelect and ComboBox. For this exemple, I have choose the FilteringSelect element.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form<span style="color: #339933;">;</span>
<span style="color: #000088;">$element</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Dojo_Form_Element_FilteringSelect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAutoComplete</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreId</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tidStore'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dojox.data.QueryReadStore'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStoreParams</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">BaseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/admin/translate/autocomplete'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttrib</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;searchAttr&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$submit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'submit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElements</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span><span style="color: #339933;">,</span> <span style="color: #000088;">$submit</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h3>Providing data for the autocomplete field</h3>
<p>Now in the controller, we create a new action autocompleteAction to generate data in json format.<br />
In this function, you must disable the view renderer and the layout.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> autocompleteAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_helper<span style="color: #339933;">-&gt;</span><span style="color: #004000;">viewRenderer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setNoRender</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_helper<span style="color: #339933;">-&gt;</span><span style="color: #004000;">layout</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">disableLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//fix : remove * at the end of the ID.</span>
&nbsp;
        <span style="color: #000088;">$MyTable</span><span style="color: #339933;">=</span> MyTable<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$MyTable</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">limit</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id LIKE ?'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$MyTable</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchAll</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$select</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Dojo_Data<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$results</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Send our output</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_helper<span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoCompleteDojo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This action will be called by the form element each time the value will change in the input and add propose 5 new possibility for the user to select. </p>
<p>(This exemple was tested on Zend Framework 1.9.5 and Dojo 1.3.2)</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=416&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/' rel='bookmark' title='Zend_Form : How to remove decorator from hidden field.'>Zend_Form : How to remove decorator from hidden field.</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' rel='bookmark' title='Add language route to your Zend Framework project.'>Add language route to your Zend Framework project.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Phenix_Wiki, a parser componant for Zend Framework</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 18:03:01 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[BBcode]]></category>
		<category><![CDATA[componant]]></category>
		<category><![CDATA[Creole]]></category>
		<category><![CDATA[Liens sur Zend Framework]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[parser class]]></category>
		<category><![CDATA[phenix]]></category>
		<category><![CDATA[Phenix_Wiki]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[singleton method]]></category>
		<category><![CDATA[superscript]]></category>
		<category><![CDATA[Wiki]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=92</guid>
		<description><![CDATA[Phenix_Wiki is a new component of the PhenixApp project. This component parse structured wiki text and render it into arbitrary formats such as XHTML. How to use it with Factory method. Factory methode returns a Phenix_Wiki Parser class for the specified parser For Default parser : 1 2 $wiki = Phenix_Wiki::factory&#40;&#34;Default&#34;&#41;; echo $wiki-&#62;transform&#40;$text, 'xhtml'&#41;; For [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Phenix_Wiki is a new component of the <a href="http://www.phenixapp-project.net">PhenixApp project</a>. This component parse structured wiki text and render it into arbitrary formats such as XHTML.<br />
<span id="more-92"></span></p>
<h3>How to use it with Factory method.</h3>
<p>Factory methode returns a Phenix_Wiki Parser class for the specified parser</p>
<p>For Default parser :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$wiki</span> <span style="color: #339933;">=</span> Phenix_Wiki<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Default&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$wiki</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transform</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xhtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code><br />
For BBcode (with specified rules):<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$rule</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Prefilter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Delimiter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Code'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Function'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Html'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Raw'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Include'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Embed'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Anchor'</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'Heading'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Toc'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Horiz'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Break'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Blockquote'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'List'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Deflist'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Table'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Image'</span><span style="color: #339933;">,</span> 
              <span style="color: #0000ff;">'Phplookup'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Center'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Newline'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Paragraph'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Url'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Freelink'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Interwiki'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Wikilink'</span><span style="color: #339933;">,</span> 
              <span style="color: #0000ff;">'Colortext'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Strong'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Bold'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Emphasis'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Italic'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Underline'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Tt'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Superscript'</span><span style="color: #339933;">,</span> 
              <span style="color: #0000ff;">'Subscript'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Revise'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Tighten'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wiki</span> <span style="color: #339933;">=</span> Phenix_Wiki<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bbcode&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rule</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$wiki</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transform</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xhtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code><br />
For Creole :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$wiki</span> <span style="color: #339933;">=</span> Phenix_Wiki<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Creole&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$wiki</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transform</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xhtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code></p>
<h3>How to use it with Singleton method</h3>
<p>This avoids instantiating multiple Phenix_Wiki instances where a number of objects are required in one call, e.g. to save memory in a CMS environment where several parsers are required in a single page.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$wiki</span> <span style="color: #339933;">=</span> Phenix_Wiki<span style="color: #339933;">::</span><span style="color: #004000;">singleton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Bbcode&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$wiki</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transform</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xhtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code></p>
<h3>Where to find the component?</h3>
<p>Web Repository : <a href="http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki">http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki</a><br />
To access via SVN : <strong>svn://phenixapp-project.net/phenixapp/trunk/PhenixApp/libs/Phenix/Wiki</strong></p>
<p>Note that this first version is not recommanded for production.</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=92&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add language route to your Zend Framework project.</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 20:59:00 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[controller plugin]]></category>
		<category><![CDATA[default controller]]></category>
		<category><![CDATA[default language]]></category>
		<category><![CDATA[default route]]></category>
		<category><![CDATA[demonstration]]></category>
		<category><![CDATA[dispatcher]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[language resources]]></category>
		<category><![CDATA[module resource]]></category>
		<category><![CDATA[module structure]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[reference guide]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=189</guid>
		<description><![CDATA[Today it&#8217;s easy to make business with other country and to join the most poeple as possible, our website must be translated in many language. This tutorial will show you how to integrate multi-language into your URL with Zend Framework controller route component and be able to use it with the Url helper in your [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Today it&#8217;s easy to make business with other country and to join the most poeple as possible, our website must be translated in many language. This tutorial will show you how to integrate multi-language into your URL with Zend Framework controller route component and be able to use it with the Url helper in your layout.</p>
<p>This tutorial requiere Zend Framework 1.8.2 version or higher.<br />
<span id="more-189"></span><br />
Summary : </p>
<ul>
<li><a href="#Route">Route configuration</a></li>
<li><a href="#Plugin">Multilanguage Plugin</a></li>
<li><a href="#url_helper">Url Helper howto</a></li>
<li><a href="#Conclusion">Conclusion</a></li>
</ul>
<h4 id="Route">Route configuration</h4>
<p>This tutorial will show you how to setup your route in .ini config. But you can do it with any other configuration type.  The demonstration will also use the Module structure of Zend Framework.</p>
<p>Here we setup the default module route without any parameters because it will automatically use the Dispatcher to setup it. Note the abstract param. This part is not actually documented in the ZF Programmer&#8217;s reference guide but Abstract parameter make the route to be unusable outside a chain route.</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ini" style="font-family:monospace;">resources.router.routes.defaultmodule.type <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Zend_Controller_Router_Route_Module</span>
resources.router.routes.defaultmodule.abstract <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> On    </span>
resources.router.routes.defaultmodule.defaults.module <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;system&quot;</span></pre></td></tr></table></div>

<p></code></p>
<p>After we setup the language route with default language if you need it and the regex of what is expected for the language value.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4
5
6
7
</pre></td><td class="code"><pre class="ini" style="font-family:monospace;">resources.router.routes.language.type <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Zend_Controller_Router_Route</span>
resources.router.routes.language.route <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;:language&quot;</span>
resources.router.routes.language.reqs.language <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;^(fr|en)$&quot;</span>
resources.router.routes.language.defaults.language <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;en&quot;</span></pre></td></tr></table></div>

<p></code></p>
<p>Than we setup the default route to overwrite the one create by default by the Front Controller.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
</pre></td><td class="code"><pre class="ini" style="font-family:monospace;">resources.router.routes.default.type <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Zend_Controller_Router_Route_Chain</span>
resources.router.routes.default.chain <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;language, defaultmodule&quot;</span></pre></td></tr></table></div>

<p></code></p>
<p>This configuration mean that if you call url like http://www.exemple.com/, language will be English, module will be default, controller will be index and action will be index.<br />
If you call http://www.exemple.com/fr/articles , language will be french, and module will be articles.</p>
<blockquote><p>Dont forgot to setup your locale and translate resources!</p></blockquote>
<h4 id="Plugin">Multilanguage Plugin</h4>
<p>In this part I will explain how to create your multilanguage plugin for controller. I assume here you know how to setup your Controller plugin into your Front Controller and pass directly to the Plugin class. It&#8217;s very basic and you will have to adapte to your own use.</p>
<p>Create a new class in your own library componant with routeShutdown method.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> My_Controller_Plugin_Multilanguage <span style="color: #000000; font-weight: bold;">extends</span> Zend_Controller_Plugin_Abstract<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> routeStartup <span style="color: #009900;">&#40;</span>Zend_Controller_Request_Abstract <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> routeShutdown <span style="color: #009900;">&#40;</span>Zend_Controller_Request_Abstract <span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></code></p>
<p>In the routeStartup method, we add a quick fix to be sure the language is alway in each RequestUri. If the language parameter is not there, we force it.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBaseUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequestUri</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setParam</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;language&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></code></p>
<p>In the routeShutdown method you will catch the language and setup the local and translator object already created by the resource. After you setup the translator to the Zend_Controller_Router_Route. This will be something like this :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$language</span> <span style="color: #339933;">=</span>  <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getParam</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;language&quot;</span><span style="color: #339933;">,</span> Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Zend_Locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLanguage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$locale</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Locale<span style="color: #009900;">&#40;</span><span style="color: #000088;">$language</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Zend_Locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocale</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$locale</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$translate</span> <span style="color: #339933;">=</span> Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Zend_Translate</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$translate</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAdapter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLocale</span><span style="color: #009900;">&#40;</span>Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Zend_Locale</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Zend_Controller_Router_Route<span style="color: #339933;">::</span><span style="color: #004000;">setDefaultTranslator</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$translate</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code></p>
<p>Once it done. Url helper will be very easy to use.</p>
<h4 id="url_helper">Url Helper howto</h4>
<p>Ok, here if you have lot of route setup, you will need the $currentRoute parameter in your url helper. If you play only with the default route, you don&#8217;t need the following part. Jump to the next step.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$front</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$router</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$currentRoute</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$router</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCurrentRouteName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$locale</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">registry</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Zend_Locale</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$currentRoute</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$currentRoute</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;language&quot;</span><span style="color: #009900;">&#41;</span>? <span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #339933;">:</span> <span style="color: #000088;">$currentRoute</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code></p>
<p>In the last part, I show you a basic Language Switch I did for my project. It check the current language and dont show the link of the current language.<br />
See the Zend_View_Helper_Url parameter. If I dont put the language param in the array, it will show the current one. This link will switch between the same page but in different language.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;langswitch&quot;&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLanguage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;fr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;language&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;fr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$currentRoute</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;Fran­­cais&lt;/a&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$locale</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLanguage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;language&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$currentRoute</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;English&lt;/a&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></td></tr></table></div>

<p></code></p>
<p>An other example that will output http://www.exemple.com/fr/articles/<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;language&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;fr&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;module&quot;</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;articles&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;action&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;list&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;default&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;Module Articles&lt;/a&gt;</pre></td></tr></table></div>

<p></code></p>
<h4 id="Conclusion">Conclusion</h4>
<p>This example is take from my current <a href="http://www.phenixapp-project.net">PhenixApp project</a>. All my source can be found in the repository. The code on my repository is not the same because I had more option like I take my default language from the database and I have some other route that I have to work with.</p>
<p>With the code in this tutorial, you get a working and easy multilanguage URL. You can integrate it very fast to your existing project because it use chain routing and dont broke any other route already exist.</p>
<p>If you like this tutorial or want to improve it, you can add comment.</p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=189&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/how-to-use-flickr-with-zend-framework/' rel='bookmark' title='How to use Flickr with Zend Framework?'>How to use Flickr with Zend Framework?</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/phenix_wiki/' rel='bookmark' title='Phenix_Wiki, a parser componant for Zend Framework'>Phenix_Wiki, a parser componant for Zend Framework</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/add-language-route-to-your-zend-framework-project/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Le projet PhenixApp</title>
		<link>http://www.m4d3l-network.com/developpement/php/le-projet-phenixapp/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/le-projet-phenixapp/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 19:49:51 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[briickwall]]></category>
		<category><![CDATA[cmf]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[composant]]></category>
		<category><![CDATA[controleur]]></category>
		<category><![CDATA[controlleur]]></category>
		<category><![CDATA[développeur]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[members]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[PhenixApp]]></category>
		<category><![CDATA[PhenixApp project]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[structure definit]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=168</guid>
		<description><![CDATA[PhenixApp est une application construite avec Zend Framework qui propose une structure définit pour que tous les développeur puisse contruire des modules compatible utilisable avec le composant principale de PhenixApp sois, Zend_Application qui permet de bien structurer le démarrage (bootstrap) de l&#8217;application. Chaque module peut écraser les configurations par défaut et donc contrôler le bootstrap. [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/le-projet-phenixapp/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p><a href="http://www.phenixapp-project.net"><img class="alignleft size-thumbnail wp-image-177" title="PhenixApp project" src="http://www.m4d3l-network.com/wp-content/uploads/2009/06/phenix-150x150.png" alt="PhenixApp project" width="150" height="150" /></a>PhenixApp est une application construite avec <a href="http://framework.zend.com/">Zend Framework</a> qui propose une structure définit pour que tous les développeur puisse contruire des modules compatible utilisable avec le composant principale de PhenixApp sois, Zend_Application qui permet de bien structurer le démarrage (bootstrap) de l&#8217;application.<br />
<span id="more-168"></span></p>
<p>Chaque module peut écraser les configurations par défaut et donc contrôler le bootstrap. Ils peuvent avoir leurs propres ressource, configuration, composant, plug-in, contrôleur, etc. De base, il y a 2 modules principaux qui viennent avec PhenixApp. Le module System qui contrôle les composants de base, sois l&#8217;installation des modules, la configuration de ceux-ci, la gestion des widgets dans le thème appeler &laquo;&nbsp;Brickwall&nbsp;&raquo; et plusieurs autres élément. Ensuite, il y a le module members qui gère l&#8217;enregistrement des membres, les groupes et les permissions. PhenixApp est dépendant du module système, mais le module members peut être remplacé par d&#8217;autre module qui fait les choses autrement.</p>
<p>PhenixApp comprend 2 types de contrôleur d&#8217;action. Sois les contrôleur public et les contrôleur d&#8217;administration. Il sont sépararer dans 2 répertoires différents ce qui peut éviter des erreurs de routing du a la confusion de 2 différentes routes. Et permet aussi d&#8217;avoir des contrôleurs de même nom pour la partit public ou administrative ce qui facilite la création des vues.</p>
<p>Une des principales fonctions du projet qui est très intéressante est la gestion du multilanguage autant dans les textes que dans l&#8217;url et l&#8217;encodage. Un système avancé vous permet de modifier directement en ligne vos traductions et traque les textes non traduits. Vous pouvez aussi ajouter des éléments à traduire directement dans vos templates et le système va les ajouter dans la database dès qu&#8217;ils seront affichés pour une première fois. Ensuite il vous restera qu&#8217;à faire la traduction dans les différentes langues.</p>
<p>Par contre, PhenixApp n&#8217;est pas encore prêt pour la production. De nombreuses interfaces d&#8217;administration restent à être terminées avant qu&#8217;une première version bêta voie le jour. Il n&#8217;y a pas encore de Base de données fournie avec le code. Nous cherche des développeurs qui aimeraient investir du temps dans le projet. Tout le code source est sur le repository tu site officiel.</p>
<p>Site du projet : <a href="http://www.phenixapp-project.net">PhenixApp-Project.net</a></p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=168&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/le-projet-phenixapp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Phenix_File_Parser_Csv</title>
		<link>http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/</link>
		<comments>http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 04:45:54 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[csv file]]></category>
		<category><![CDATA[CSV parser]]></category>
		<category><![CDATA[phenix]]></category>
		<category><![CDATA[Phenix_File_Parser_Csv]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=136</guid>
		<description><![CDATA[If you need a CSV parser in PHP, this class is for you. You can download the class from the repository of PhenixApp project : Phenix_File_Parser_Csv This class open the CSV file, parse the data into the object and after you just need to use the object like an array. 1 2 3 4 5 [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>If you need a CSV parser in PHP, this class is for you. </p>
<p>You can download the class from the repository of <a href="http://www.phenixapp-project.net">PhenixApp project</a> : <a href="http://www.phenixapp-project.net/repositories/entry/phenixapp/trunk/PhenixApp/libs/Phenix/File/Parser/Csv.php">Phenix_File_Parser_Csv</a><br />
<span id="more-136"></span><br />
This class open the CSV file, parse the data into the object and after you just need to use the object like an array.</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$csvParser</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Phenix_File_Parser_Csv<span style="color: #009900;">&#40;</span>
    <span style="color: #000088;">$filename</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">//CSV file name</span>
    <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">//Start at row 1</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;detail&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;lastupdate&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//Column expected to read in the CSV file.</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//use like an array</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$csvParser</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastupdate'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></code></p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=136&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phenix_View_Helper_Text2image (English)</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 03:41:59 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[Image generator]]></category>
		<category><![CDATA[PhenixApp]]></category>
		<category><![CDATA[Phenix_View]]></category>
		<category><![CDATA[Phenix_View_Helper]]></category>
		<category><![CDATA[Phenix_View_Helper_Text2image]]></category>
		<category><![CDATA[Text to image]]></category>
		<category><![CDATA[Zend_View]]></category>
		<category><![CDATA[Zend_View_Helper]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=132</guid>
		<description><![CDATA[Did you already got the probleme to create a menu with image because the font was not a standard web font and you has to make again and again the menu because you clients ask you to do many change? This helper is the solution. What is Phenix_View_Helper_Text2image? This is a simple View Helper for [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Did you already got the probleme to create a menu with image because the font was not a standard web font and you has to make again and again the menu because you clients ask you to do many change? This helper is the solution.<br />
<span id="more-132"></span></p>
<h4>What is Phenix_View_Helper_Text2image?</h4>
<p>This is a simple View Helper for Zend Framework that allow you to transform on the fly a string texte to an image with the good font, size, background and position. When the image are generated, they are stored in an image folder and they are never regenereted else if you change a params of an image. This is a big avantage for the designer that doesnt have to care about the font or disposition to use.</p>
<p>Configuration :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$param</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #666666; font-style: italic;">/* For image menu with special font */</span>
<span style="color: #0000ff;">'imgdir'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;home/user/public_html/images&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'imgurl'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;/images&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'font'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;/home/user/App/Fonts/ITCKrist.TTF&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'fsize'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'flag'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;menu&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">170</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">26</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tcolor'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#4e6549&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bgcolor'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tposition_x'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tposition_y'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">20</span>
<span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p></code><br />
Create all menu image :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;ul class=&quot;navmenu&quot;&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Acceuil&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Produits&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contactez-nous&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></td></tr></table></div>

<p></code><br />
Note that if image already exist, only the image tag will be generated.</p>
<h4>Where I can download this helper?</h4>
<p>You can download this helper on the repository of <a href="http://www.phenixapp-project.net">PhenixApp project</a>. <a href="http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/View/Helper/">View_Helper repository</a></p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=132&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image'>Phenix_View_Helper_Text2image</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend_Form : How to remove decorator from hidden field.</title>
		<link>http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/</link>
		<comments>http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 16:25:25 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[decorator]]></category>
		<category><![CDATA[dt]]></category>
		<category><![CDATA[DtDdWrapper]]></category>
		<category><![CDATA[form decorator]]></category>
		<category><![CDATA[form element]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[hidden element]]></category>
		<category><![CDATA[hidden field]]></category>
		<category><![CDATA[phenix]]></category>
		<category><![CDATA[remove decorator]]></category>
		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=106</guid>
		<description><![CDATA[This question come a lot in #ZFtalk channel on IRC. The Default decorator apply the DtDdWrapper to all form element when they are created. But hidden field does&#8217;nt need decorator and the actual hidden element class does&#8217;nt care about that. Actually, without decorator remove, hidden field will output like the following and this is bad. [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>This question come a lot in #ZFtalk channel on IRC.</p>
<p>The Default decorator apply the DtDdWrapper to all form element when they are created. But hidden field does&#8217;nt need decorator and the actual hidden element class does&#8217;nt care about that.<br />
<span id="more-106"></span></p>
<p>Actually, without decorator remove, hidden field will output like the following and this is bad.<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>dt id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement-label&quot;</span><span style="color: #339933;">&gt;&amp;</span>nbsp<span style="color: #339933;">;&lt;/</span>dt<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>dd id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement-element&quot;</span><span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;something&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement&quot;</span><span style="color: #339933;">&gt;&lt;/</span>dd<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p></code></p>
<p>So to remove the decorator, you can do this after create your hidden element:<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hidden'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$id</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeDecorator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DtDdWrapper'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$id</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeDecorator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HtmlTag'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$id</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">removeDecorator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Label'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElement</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></code></p>
<p>This is important because this will prevent to get unwanted result if you add css to your DT/Dd decorator. After remove these decorator, this will print only the input hidden field.</p>
<p><code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;something&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MyElement&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p></code></p>
<p>With the <a href="http://www.phenixapp-project.net">PhenixApp</a> project, I have decided to extends the default hidden element class to remove decorator of each hidden field indefinitely.<br />
I think this way is better because this prevent some method to be executed for nothing and this is more quick to add hidden field in all my form after.</p>
<p>Here is my class :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Phenix_Form_Element_Hidden <span style="color: #000000; font-weight: bold;">extends</span> Zend_Form_Element_Hidden
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDisableLoadDefaultDecorators</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addDecorator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ViewHelper&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></code></p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=106&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/autocomplete-field-with-zend-framework-and-dojo/' rel='bookmark' title='Autocomplete field with Zend Framework and Dojo'>Autocomplete field with Zend Framework and Dojo</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/php/zend-framework/zend_form-how-to-remove-decorator-from-hidden-field/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Phenix_View_Helper_Text2image</title>
		<link>http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/</link>
		<comments>http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 18:39:01 +0000</pubDate>
		<dc:creator>M4d3L</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[image menu]]></category>
		<category><![CDATA[phenix]]></category>
		<category><![CDATA[Phenix_View]]></category>
		<category><![CDATA[Text2image]]></category>
		<category><![CDATA[View_Helper]]></category>
		<category><![CDATA[Zend_View]]></category>

		<guid isPermaLink="false">http://www.m4d3l-network.com/?p=26</guid>
		<description><![CDATA[Avez-vous déjà éprouvé le problème de créer un menu pour un site web sous forme d&#8217;image, car la police n&#8217;est pas standard au web et qu&#8217;ensuite vous ailler souvent a refaire le menu, car sois le site est traduit ou encore votre client vous demande des ajouts et modifications très souvent? Ce nouveau helper est [...]
Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='wpfblike' style='height: 40px;'><fb:like href='http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/' layout='default' show_faces='true' width='400' action='recommend' colorscheme='light' send='false' /></div><p>Avez-vous déjà éprouvé le problème de créer un menu pour un site web sous forme d&#8217;image, car la police n&#8217;est pas standard au web et qu&#8217;ensuite vous ailler souvent a refaire le menu, car sois le site est traduit ou encore votre client vous demande des ajouts et modifications très souvent? Ce nouveau helper est donc la solution pour vous.<br />
<span id="more-26"></span></p>
<h4>Qu&#8217;est-ce que Phenix_View_Helper_Text2image?</h4>
<p>C&#8217;est simplement un View Helper pour Zend Framework qui vous permet de transformer &laquo;&nbsp;on the fly&nbsp;&raquo; un texte en image avec la police de caractère voulu, la grandeur et aussi la possibilité d&#8217;avoir un arrière-plan pour chaque image. Les images créées sont ensuite sauvegardées dans le répertoire de votre choix et ne seront pas recréées à chaque fois que la page est demandée sauf si n&#8217;importe laquelle des configurations est changée.</p>
<p>Configuration :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$param</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #666666; font-style: italic;">/* For image menu with special font */</span>
<span style="color: #0000ff;">'imgdir'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;home/user/public_html/images&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'imgurl'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;/images&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'font'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;/home/user/App/Fonts/ITCKrist.TTF&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'fsize'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'flag'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;menu&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">170</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">26</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tcolor'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#4e6549&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bgcolor'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;#FFFFFF&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tposition_x'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tposition_y'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">20</span>
<span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p></code><br />
Creer toutes les images du menu :<br />
<code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;ul class=&quot;navmenu&quot;&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Acceuil&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Produits&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Text2image</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contactez-nous&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></td></tr></table></div>

<p></code></p>
<h4>Où trouver ce Helper?</h4>
<p>Vous pouvez trouver ce helper sur le repository de PhenixApp. <a href="http://www.phenixapp-project.net/repositories/browse/phenixapp/trunk/PhenixApp/libs/Phenix/View/Helper/">Par ici.</a></p>
<img src="http://www.m4d3l-network.com/?ak_action=api_record_view&id=26&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://www.m4d3l-network.com/developpement/php/zend-framework/en-phenix_view_helper_text2image/' rel='bookmark' title='Phenix_View_Helper_Text2image (English)'>Phenix_View_Helper_Text2image (English)</a></li>
<li><a href='http://www.m4d3l-network.com/developpement/phenix_file_parser_csv/' rel='bookmark' title='Phenix_File_Parser_Csv'>Phenix_File_Parser_Csv</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.m4d3l-network.com/developpement/phenix_view_helper_text2image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

