<?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"
	>

<channel>
	<title>Me, mysql and php</title>
	<atom:link href="http://maraz.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://maraz.org</link>
	<description></description>
	<pubDate>Wed, 13 Aug 2008 13:22:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Zend Framework &#038; ExtJS Grid - part 1</title>
		<link>http://maraz.org/2008/07/24/zend-framework-extjs-grid-part-1/</link>
		<comments>http://maraz.org/2008/07/24/zend-framework-extjs-grid-part-1/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 16:28:19 +0000</pubDate>
		<dc:creator>silvester</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Extjs]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://maraz.org/?p=24</guid>
		<description><![CDATA[The old way to make a grid was very time consuming. Basically it is just copy paste but still there is a lot to rewrite. You have to take care of the actions, pager and maybe a filter.
So i tried ext js grid. Since extjs renders the grid alone and looks a lot better then [...]]]></description>
			<content:encoded><![CDATA[<p>The old way to make a grid was very time consuming. Basically it is just copy paste but still there is a lot to rewrite. You have to take care of the actions, pager and maybe a filter.</p>
<p>So i tried ext js grid. Since extjs renders the grid alone and looks a lot better then my grids which are done with smarty, html table and css.<br />
<span id="more-24"></span><br />
A good grid should</p>
<ul>
<li>Paginate</li>
<li>Filter</li>
<li>Sort</li>
<li>Edit ??? (maybe)</li>
</ul>
<p>To make an extjs grid you need 3 pieces of code. Store, Columns and the Grid its self. Since Zend framework DB model component has some information we can use, I tried to automate a piece of it.</p>
<p>Not to forget, you have to create models for the tables that you want to use. The extended zend_db_table will create a .js file for us which includes the store and the columns model for our grid. After the file is created we can manually edit and change it to fit our needs, like hiding some columns or different formating.</p>
<h3>The Store</h3>
<p>I also extended the zend_db_rowset to return json data for its rowset, so i do use the Ext.data.JsonStore. it looks like this.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782c60970">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782c60970').style.display='block';document.getElementById('plain_synthi_4927782c60970').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">var xmlStore = new Ext.data.JsonStore({
	url: '/some/index/xml-list/', // here we have an action in some module, index controller
	fields: xml_st, // created via zend_db_table
	totalProperty: 'count', // calculated from zend_db_table
	root: 'xml' // allways the table name, xml here is not the output format!!!
});</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782c60970">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782c60970').style.display='block';document.getElementById('styled_synthi_4927782c60970').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> xmlStore = <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">data</span>.<span style="color: #006600;">JsonStore</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; url: <span style="color: #3366CC;">&#8216;/some/index/xml-list/&#8217;</span>, <span style="color: #009900; font-style: italic;">// here we have an action in some module, index controller</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; fields: xml_st, <span style="color: #009900; font-style: italic;">// created via zend_db_table</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; totalProperty: <span style="color: #3366CC;">&#8216;count&#8217;</span>, <span style="color: #009900; font-style: italic;">// calculated from zend_db_table</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; root: <span style="color: #3366CC;">&#8216;xml&#8217;</span> <span style="color: #009900; font-style: italic;">// allways the table name, xml here is not the output format!!!</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
<p>Now the created fields from zend_db_table. Also not to forget we have to include the created files from zend_db_table.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782c67777">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782c67777').style.display='block';document.getElementById('plain_synthi_4927782c67777').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">// this is created from zend_db_table.
var xml_st = [
	{name: 'xml_id', type: 'int'},
	{name: 'created_on', type: 'date', dateFormat: 'Y-m-d H:i:s'},
	{name: 'updated_on', type: 'date', dateFormat: 'Y-m-d H:i:s'},
	{name: 'xml_name', type: 'string'},
	{name: 'xml_description', type: 'string'},
	{name: 'status', type: 'int'}
];</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782c67777">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782c67777').style.display='block';document.getElementById('styled_synthi_4927782c67777').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// this is created from zend_db_table.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> xml_st = <span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8216;xml_id&#8217;</span>, type: <span style="color: #3366CC;">&#8216;int&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8216;created_on&#8217;</span>, type: <span style="color: #3366CC;">&#8216;date&#8217;</span>, dateFormat: <span style="color: #3366CC;">&#8216;Y-m-d H:i:s&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8216;updated_on&#8217;</span>, type: <span style="color: #3366CC;">&#8216;date&#8217;</span>, dateFormat: <span style="color: #3366CC;">&#8216;Y-m-d H:i:s&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8216;xml_name&#8217;</span>, type: <span style="color: #3366CC;">&#8217;string&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8216;xml_description&#8217;</span>, type: <span style="color: #3366CC;">&#8217;string&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><span style="color: #000066;">name</span>: <span style="color: #3366CC;">&#8217;status&#8217;</span>, type: <span style="color: #3366CC;">&#8216;int&#8217;</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
<p>Because we have the information of the field from mysql and zend_db_table we can create this file. So if you would need some more improvement you could edit the created file and add some more meta data.</p>
<h3>The Column Model</h3>
<p>We can also create some basic information about the columns with the meta data from mysql for the table.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782c769ed">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782c769ed').style.display='block';document.getElementById('plain_synthi_4927782c769ed').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">// this is created from zend_db_table
var xml_cm = [
	{header: 'xml_id', dataIndex: 'xml_id', id: 'xml_id', resizeable: true, sortable: true, align: 'right'},
	{header: 'created_on', dataIndex: 'created_on', id: 'created_on', resizeable: true, sortable: true, renderer: Ext.util.Format.dateRenderer('d.m.Y')},
	{header: 'updated_on', dataIndex: 'updated_on', id: 'updated_on', resizeable: true, sortable: true, renderer: Ext.util.Format.dateRenderer('d.m.Y')},
	{header: 'xml_name', dataIndex: 'xml_name', id: 'xml_name', resizeable: true, sortable: true},
	{header: 'xml_description', dataIndex: 'xml_description', id: 'xml_description', resizeable: true, sortable: true},
	{header: 'status', dataIndex: 'status', id: 'status', resizeable: true, sortable: true, hidden: true}
];</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782c769ed">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782c769ed').style.display='block';document.getElementById('styled_synthi_4927782c769ed').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// this is created from zend_db_table</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> xml_cm = <span style="color: #66cc66;">&#91;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8216;xml_id&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8216;xml_id&#8217;</span>, id: <span style="color: #3366CC;">&#8216;xml_id&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span>, align: <span style="color: #3366CC;">&#8216;right&#8217;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8216;created_on&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8216;created_on&#8217;</span>, id: <span style="color: #3366CC;">&#8216;created_on&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span>, renderer: Ext.<span style="color: #006600;">util</span>.<span style="color: #006600;">Format</span>.<span style="color: #006600;">dateRenderer</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;d.m.Y&#8217;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8216;updated_on&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8216;updated_on&#8217;</span>, id: <span style="color: #3366CC;">&#8216;updated_on&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span>, renderer: Ext.<span style="color: #006600;">util</span>.<span style="color: #006600;">Format</span>.<span style="color: #006600;">dateRenderer</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;d.m.Y&#8217;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8216;xml_name&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8216;xml_name&#8217;</span>, id: <span style="color: #3366CC;">&#8216;xml_name&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8216;xml_description&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8216;xml_description&#8217;</span>, id: <span style="color: #3366CC;">&#8216;xml_description&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span>header: <span style="color: #3366CC;">&#8217;status&#8217;</span>, dataIndex: <span style="color: #3366CC;">&#8217;status&#8217;</span>, id: <span style="color: #3366CC;">&#8217;status&#8217;</span>, resizeable: <span style="color: #003366; font-weight: bold;">true</span>, sortable: <span style="color: #003366; font-weight: bold;">true</span>, hidden: <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#93;</span>; </div>
</li>
</ol>
</div>
</div>
<p>In this example i added the information about hidden:true. You can still change some other setting.</p>
<h3>The Grid</h3>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782c9551f">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782c9551f').style.display='block';document.getElementById('plain_synthi_4927782c9551f').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">// this is all we have to write to make a basic grid
var xmlGrid = new Ext.grid.GridPanel({
	renderTo: 'xml_div',
	title: 'XML',
	store: xmlStore,
	columns: xml_cm, // the created column model
	stripeRows: true,
	border: true,
	frame: true
});</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782c9551f">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782c9551f').style.display='block';document.getElementById('styled_synthi_4927782c9551f').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// this is all we have to write to make a basic grid</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> xmlGrid = <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">grid</span>.<span style="color: #006600;">GridPanel</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; renderTo: <span style="color: #3366CC;">&#8216;xml_div&#8217;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; title: <span style="color: #3366CC;">&#8216;XML&#8217;</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; store: xmlStore,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; columns: xml_cm, <span style="color: #009900; font-style: italic;">// the created column model</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; stripeRows: <span style="color: #003366; font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; border: <span style="color: #003366; font-weight: bold;">true</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; frame: <span style="color: #003366; font-weight: bold;">true</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
<p>So this would be the basic grid. in next series we also are going to add the pager, grouping, filter and maybe some other stuff and demonstrate how it work together with zend_framework.</p>
<h3>The PHP Part</h3>
<p>This is the basic extend for the zend_db_table. If you do not want to use this class you can use (copy &amp; paste) the code. I do not need any credits.</p>
<p>We have here to function one of them is getCount(). This function hepls us to get the count for the rowset object and the information is also used for the pager.</p>
<p>extWriteGridSettings(), will write a .js file for its model. So if you have a model called xml it will write xml_gs.js to the folder which you set (GridSettings).</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782c9de07">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782c9de07').style.display='block';document.getElementById('plain_synthi_4927782c9de07').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">getAdapter()-&gt;fetchOne(&#034;select count(*) as count from {$this-&gt;_name} where $where&#034;);
		} else {
			$count = $this-&gt;getAdapter()-&gt;fetchOne(&#034;select count(*) as count from {$this-&gt;_name}&#034;);
		}

		return $count;

	}

	public function extWriteGridSettings() // write some settings
	{

		$cm = &#034;var {$this-&gt;_name}_cm = [\n&#034;;
		$st = &#034;var {$this-&gt;_name}_st = [\n&#034;;

		foreach($this-&gt;_metadata as $index =&gt; $arr) { // the metadata

			switch($arr['DATA_TYPE']) {
				case 'int':
					$type = 'int';
					$cmExtra = &#034;, align: 'right'&#034;;
					break;
				case 'mediumint':
					$type = 'int';
					$cmExtra = &#034;, align: 'right'&#034;;
					break;
				case 'timestamp':
					$type = 'date';
					$stExtra = &#034;, dateFormat: 'Y-m-d H:i:s'&#034;;
					$cmExtra = &#034;, renderer: Ext.util.Format.dateRenderer('d.m.Y')&#034;;
					break;
				case 'decimal':
					$type = 'auto';
					$cmExtra = &#034;, align: 'right', renderer: Ext.util.Format.Currency&#034;;
					break;
				case 'varchar':
					$type = 'string';
					break;
				case 'tinyint':
					$type = 'int';
					break;
				case 'text':
					$type = 'string';
					break;
				default:
					$type = 'auto';
					break;
			}

			if(strlen($this-&gt;sortables[$index]) &gt; 0) {
				$cmArr[] = &#034;\n\t{header: '{$this-&gt;sortables[$index]}', dataIndex: '$index', id: '$index', resizeable: true, sortable: true{$cmExtra}}&#034;;
			} else {
				$cmArr[] = &#034;\n\t{header: '$index', dataIndex: '$index', id: '$index', resizeable: true, sortable: true{$cmExtra}}&#034;;
			}

			$stArr[] = &#034;\n\t{name: '$index', type: '$type'$stExtra}&#034;;

			$type = '';
			$stExtra = '';
			$cmExtra = '';

		}

		$cm .= implode(', ', $cmArr).&#034;\n\n];\n\n&#034;;
		$st .= implode(', ', $stArr).&#034;\n\n];&#034;;

		$cf = Zend_Registry::get('config');

		$fp = fopen($cf-&gt;path-&gt;file.'pub/js/ext-cache/'.$this-&gt;_name.'_gs.js', 'a'); // write where ever you wish

		fwrite($fp, $cm.$st);

		fclose($fp);

		chmod($cf-&gt;path-&gt;file.'pub/js/ext-cache/'.$this-&gt;_name.'_gs.js', 0777);

	}

}</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782c9de07">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782c9de07').style.display='block';document.getElementById('styled_synthi_4927782c9de07').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="php" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">getAdapter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&amp;gt;fetchOne<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select count(*) as count from {$this-&amp;gt;_name} where $where&quot;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$count</span> = <span style="color: #0000ff;">$this</span>-&amp;gt;getAdapter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-&amp;gt;fetchOne<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select count(*) as count from {$this-&amp;gt;_name}&quot;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$count</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; public <span style="color: #000000; font-weight: bold;">function</span> extWriteGridSettings<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// write some settings</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cm</span> = <span style="color: #ff0000;">&quot;var {$this-&amp;gt;_name}_cm = [<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$st</span> = <span style="color: #ff0000;">&quot;var {$this-&amp;gt;_name}_st = [<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&amp;gt;_metadata <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$index</span> =&amp;gt; <span style="color: #0000ff;">$arr</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// the metadata</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$arr</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'DATA_TYPE'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'int'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'int'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmExtra</span> = <span style="color: #ff0000;">&quot;, align: 'right'&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'mediumint'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'int'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmExtra</span> = <span style="color: #ff0000;">&quot;, align: 'right'&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'timestamp'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'date'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$stExtra</span> = <span style="color: #ff0000;">&quot;, dateFormat: 'Y-m-d H:i:s'&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmExtra</span> = <span style="color: #ff0000;">&quot;, renderer: Ext.util.Format.dateRenderer('d.m.Y')&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'decimal'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'auto'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmExtra</span> = <span style="color: #ff0000;">&quot;, align: 'right', renderer: Ext.util.Format.Currency&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'varchar'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'string'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'tinyint'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'int'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'text'</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'string'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">default</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">'auto'</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #000066;">strlen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&amp;gt;sortables<span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$index</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> &amp;gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmArr</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>{header: '{$this-&amp;gt;sortables[$index]}&#8217;, dataIndex: &#8216;$index&#8217;, id: &#8216;$index&#8217;, resizeable: true, sortable: true{$cmExtra}}&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmArr</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>{header: &#8216;$index&#8217;, dataIndex: &#8216;$index&#8217;, id: &#8216;$index&#8217;, resizeable: true, sortable: true{$cmExtra}}&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$stArr</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>{name: &#8216;$index&#8217;, type: &#8216;$type&#8217;$stExtra}&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$type</span> = <span style="color: #ff0000;">&#8221;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$stExtra</span> = <span style="color: #ff0000;">&#8221;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cmExtra</span> = <span style="color: #ff0000;">&#8221;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cm</span> .= <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;, &#8216;</span>, <span style="color: #0000ff;">$cmArr</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>];<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$st</span> .= <a href="http://www.php.net/implode"><span style="color: #000066;">implode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;, &#8216;</span>, <span style="color: #0000ff;">$stArr</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>];&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cf</span> = Zend_Registry::<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;config&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$fp</span> = <a href="http://www.php.net/fopen"><span style="color: #000066;">fopen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cf</span>-&amp;gt;path-&amp;gt;file.<span style="color: #ff0000;">&#8216;pub/js/ext-cache/&#8217;</span>.<span style="color: #0000ff;">$this</span>-&amp;gt;_name.<span style="color: #ff0000;">&#8216;_gs.js&#8217;</span>, <span style="color: #ff0000;">&#8216;a&#8217;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// write where ever you wish</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fwrite"><span style="color: #000066;">fwrite</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fp</span>, <span style="color: #0000ff;">$cm</span>.<span style="color: #0000ff;">$st</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #000066;">fclose</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$fp</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/chmod"><span style="color: #000066;">chmod</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cf</span>-&amp;gt;path-&amp;gt;file.<span style="color: #ff0000;">&#8216;pub/js/ext-cache/&#8217;</span>.<span style="color: #0000ff;">$this</span>-&amp;gt;_name.<span style="color: #ff0000;">&#8216;_gs.js&#8217;</span>, <span style="color: #cc66cc;">0777</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>All of my models extend the reverse_db_table so i have allways the functions. Just use once $model-&gt;extWriteGridSettings(); and it will write it do disk.</p>
<p>Now the rowset extend.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782de88f8">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782de88f8').style.display='block';document.getElementById('plain_synthi_4927782de88f8').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">_table-&gt;getCount($where);

		$count = 0;
		foreach($this-&gt;_data as $key =&gt; $value) {
			$arr[$this-&gt;_table-&gt;info('name')][$count] = $value;
			$count++;
		}

		if($count == 0) {
			$arr[$this-&gt;_table-&gt;info('name')];
		}

		return Zend_Json::encode($arr);

	}

}</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782de88f8">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782de88f8').style.display='block';document.getElementById('styled_synthi_4927782de88f8').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="php" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">_table-&amp;gt;getCount<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$where</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$count</span> = <span style="color: #cc66cc;">0</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&amp;gt;_data <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&amp;gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$arr</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$this</span>-&amp;gt;_table-&amp;gt;info<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;name&#8217;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$count</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0000ff;">$value</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$count</span>++;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$count</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$arr</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$this</span>-&amp;gt;_table-&amp;gt;info<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;name&#8217;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> Zend_Json::<span style="color: #006600;">encode</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$arr</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>Now some usage examples.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782e14760">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782e14760').style.display='block';document.getElementById('plain_synthi_4927782e14760').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">public function xmlListAction()
{
	$this-&gt;_autoRender = false; // my internal funciton to stop smarty from rendering
	$xmlModel = new xmls(); // the model
	$rs = $xmlModel-&gt;fetchAll();
	echo $rs-&gt;toExtJson(); // the record set
}</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782e14760">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782e14760').style.display='block';document.getElementById('styled_synthi_4927782e14760').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="php" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public <span style="color: #000000; font-weight: bold;">function</span> xmlListAction<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&amp;gt;_autoRender = <span style="color: #000000; font-weight: bold;">false</span>; <span style="color: #808080; font-style: italic;">// my internal funciton to stop smarty from rendering</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$xmlModel</span> = <span style="color: #000000; font-weight: bold;">new</span> xmls<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// the model</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$rs</span> = <span style="color: #0000ff;">$xmlModel</span>-&amp;gt;fetchAll<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$rs</span>-&amp;gt;toExtJson<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// the record set</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>This is a simple action in zend_controller.</p>
<p>Thats it for today. I am very sorry of my english and writing skills but i will answer the comment (maybe :-) ).</p>
]]></content:encoded>
			<wfw:commentRss>http://maraz.org/2008/07/24/zend-framework-extjs-grid-part-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>prototype, scriptaculous Chained Select</title>
		<link>http://maraz.org/2007/05/23/prototype-scriptaculous-chained-select/</link>
		<comments>http://maraz.org/2007/05/23/prototype-scriptaculous-chained-select/#comments</comments>
		<pubDate>Wed, 23 May 2007 16:56:26 +0000</pubDate>
		<dc:creator>silvester</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Prototype]]></category>

		<category><![CDATA[Scriptaculous]]></category>

		<guid isPermaLink="false">http://maraz.org/2007/05/23/prototype-scriptaculous-chained-select/</guid>
		<description><![CDATA[For one of my projects i had to make some select boxes which would work in a chain. I had 500.000 inserts in mysql which should be found easily. So i implemented 5 chained select boxes. 
The first part of the project was not meant to be public so i limited my work to Firefox. [...]]]></description>
			<content:encoded><![CDATA[<p>For one of my projects i had to make some select boxes which would work in a chain. I had 500.000 inserts in mysql which should be found easily. So i implemented 5 chained select boxes. </p>
<p>The first part of the project was not meant to be public so i limited my work to Firefox. But after a while the public part started and i wanted to use some ready made widgets in smarty (like my address widget with 5 chained select boxes). When i tried it in IE 6 it did not worked.<br />
<span id="more-15"></span><br />
Here is how it looks like. The next select box will be loaded onchange of the parent select box.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782f9651c">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782f9651c').style.display='block';document.getElementById('plain_synthi_4927782f9651c').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<select name=&#034;address[some]&#034; id=&#034;some&#034; onchange=&#034;loadSomeMore();&#034;>
       <option value=&#034;none&#034;>- - - - - - - - - - - - -</option>
</select>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782f9651c">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782f9651c').style.display='block';document.getElementById('styled_synthi_4927782f9651c').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/select.html"><span style="color: #000000; font-weight: bold;">&lt;select</span></a> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;address[some]&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;some&quot;</span> <span style="color: #000066;">onchange</span>=<span style="color: #ff0000;">&quot;loadSomeMore();&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><a href="http://december.com/html/4/element/option.html"><span style="color: #000000; font-weight: bold;">&lt;option</span></a> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>- - - - - - - - - - - - -<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/option&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/select&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782fb6c02">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782fb6c02').style.display='block';document.getElementById('plain_synthi_4927782fb6c02').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
function loadSomeMore() {
	if($F('some') != 'none') {
		var opt = {
			onSuccess: function(t) {
				Element.update('someMore', t.responseText);
			}
		}
		new Ajax.Request('/ajax/address/someMore/' + $F('some') + '/', opt);
	}
}
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782fb6c02">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782fb6c02').style.display='block';document.getElementById('styled_synthi_4927782fb6c02').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> loadSomeMore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$F<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;some&#8217;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #3366CC;">&#8216;none&#8217;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> opt = <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onSuccess: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Element.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;someMore&#8217;</span>, t.<span style="color: #006600;">responseText</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #006600;">Request</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;/ajax/address/someMore/&#8217;</span> + $F<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;some&#8217;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">&#8216;/&#8217;</span>, opt<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>I started to look on http:\\www.google.com for a similar problem. I found the problem with IE 6, but there was no real fix to the problem. The problem was Element.update() of prototype. There was a fix (i think on rails mailing list) which hacks protoype.js. It works but it replaces the whole select box instead of changing only the options. So if you change also the select tag you loose the onchange trigger so you cannot trigger the next select box.</p>
<p>So since i knew the name of function which should be called via on change. I changed the functions with Element.replace.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782fc14d0">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782fc14d0').style.display='block';document.getElementById('plain_synthi_4927782fc14d0').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
function loadSomeMore() {
	if($F('some') != ''none) {
		var opt = {
			onSuccess: function(t) {
				$('someMore').replace('
<select name=&#034;address[someMore]&#034; id=&#034;SomeMore&#034; onchange=&#034;someEvenMore();&#034;>' + t.responseText + '</select>

');
			}
		}
		new Ajax.Request('/ajax/address/somevenMore/' + $F('some') + '/', opt);
	}
}
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782fc14d0">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782fc14d0').style.display='block';document.getElementById('styled_synthi_4927782fc14d0').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> loadSomeMore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$F<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;some&#8217;</span><span style="color: #66cc66;">&#41;</span> != <span style="color: #3366CC;">&#8221;</span>none<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> opt = <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onSuccess: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>t<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;someMore&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;&lt;select name=&quot;address[someMore]&quot; id=&quot;SomeMore&quot; onchange=&quot;someEvenMore();&quot;&gt;&#8217;</span> + t.<span style="color: #006600;">responseText</span> + <span style="color: #3366CC;">&#8216;&lt;/select&gt;&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #006600;">Request</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;/ajax/address/somevenMore/&#8217;</span> + $F<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8217;some&#8217;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">&#8216;/&#8217;</span>, opt<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>So if you want to make chained selects with prototype, instead of updating the select box options just replace the whole select box with its options. So the response from ajax would be:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782fceb2f">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782fceb2f').style.display='block';document.getElementById('plain_synthi_4927782fceb2f').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<select onchange=&#034;loadNextSelectBox();&#034;>
     <option>
     <option>
</select>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782fceb2f">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782fceb2f').style.display='block';document.getElementById('styled_synthi_4927782fceb2f').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/select.html"><span style="color: #000000; font-weight: bold;">&lt;select</span></a> <span style="color: #000066;">onchange</span>=<span style="color: #ff0000;">&quot;loadNextSelectBox();&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><a href="http://december.com/html/4/element/option.html"><span style="color: #000000; font-weight: bold;">&lt;option&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><a href="http://december.com/html/4/element/option.html"><span style="color: #000000; font-weight: bold;">&lt;option&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/select&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
<p>instead of </p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4927782fe3aa0">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4927782fe3aa0').style.display='block';document.getElementById('plain_synthi_4927782fe3aa0').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<option>
<option>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4927782fe3aa0">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4927782fe3aa0').style.display='block';document.getElementById('styled_synthi_4927782fe3aa0').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/option.html"><span style="color: #000000; font-weight: bold;">&lt;option&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/option.html"><span style="color: #000000; font-weight: bold;">&lt;option&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
<p>I am not sure if the example above would work, the id&#8217;s are mixed. But otherwise the script works fine. The next functions for next child in chained select is almost copy paste, so it is fast to make.</p>
<p>Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://maraz.org/2007/05/23/prototype-scriptaculous-chained-select/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting lazy with frameworks (ZEND)</title>
		<link>http://maraz.org/2007/05/16/getting-lazy-with-frameworks-zend/</link>
		<comments>http://maraz.org/2007/05/16/getting-lazy-with-frameworks-zend/#comments</comments>
		<pubDate>Wed, 16 May 2007 20:58:56 +0000</pubDate>
		<dc:creator>silvester</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://maraz.org/2007/05/16/getting-lazy-with-frameworks-zend/</guid>
		<description><![CDATA[For my new huge project, i did some research so I would work less. I started with cake php and after one week learning i decided that it is no good for me. My last project is not a web site and cakephp looks like it is done for making blogs and news pages.
Then i [...]]]></description>
			<content:encoded><![CDATA[<p>For my new huge project, i did some research so I would work less. I started with cake php and after one week learning i decided that it is no good for me. My last project is not a web site and cakephp looks like it is done for making blogs and news pages.</p>
<p>Then i started to look at ZEND FRAMEWORK. It is a lot more flexible then cakephp and i also didnt needed scafolding. So after learning about a week I started to work on the project. In the begining it went very well, but after 2 month the pain started. I just got to lazy and depended on the framework.</p>
<p>On my earlier projects I allways wrote a small framework which would help me to work through the project. If i had to write something more than twice, I decided to write a function or even better an object.</p>
<p>When i work with zend framework, i just skipped the first process and started to write hardcoded in to the actions. Now as things get more complicated I have a great lack of my usual objects and classes.</p>
<p>So i learned, never get layz of writing the helpers of a project. Take around 30% in the begining of a project for writing your own objects. This will also help you to solve problems even before they occur.</p>
]]></content:encoded>
			<wfw:commentRss>http://maraz.org/2007/05/16/getting-lazy-with-frameworks-zend/feed/</wfw:commentRss>
		</item>
		<item>
		<title>script.aculo.us Effect.toggle.(&#8217;MyAss&#8217;)</title>
		<link>http://maraz.org/2007/01/06/scriptaculous-effecttogglemyass/</link>
		<comments>http://maraz.org/2007/01/06/scriptaculous-effecttogglemyass/#comments</comments>
		<pubDate>Sat, 06 Jan 2007 02:01:36 +0000</pubDate>
		<dc:creator>silvester</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Javascript]]></category>

		<category><![CDATA[Prototype]]></category>

		<category><![CDATA[Scriptaculous]]></category>

		<guid isPermaLink="false">http://maraz.org/2007/01/06/scriptaculous-effecttogglemyass/</guid>
		<description><![CDATA[For one of my clients, i had to clean up some mess which was done by another college. The web site has a registration form and a login form which is both in the same screen. This makes the screen look too big and too complicated. There were also some fields and forms which are [...]]]></description>
			<content:encoded><![CDATA[<p>For one of my clients, i had to clean up some mess which was done by another college. The web site has a registration form and a login form which is both in the same screen. This makes the screen look too big and too complicated. There were also some fields and forms which are at wish if you only choose specific options.</p>
<p>So i decided to make the form look smaller. I wanted to hide some fields until they are not checked or used. I stared to program at 21:40.</p>
<h3>1. Scenario 21:50 (after some cigarets and jagermeister)</h3>
<p>I have some background experience with <a href="http://mootools.net" target="_blank">http://mootools.net</a> and <a href="http://script.aculo.us/">http://script.aculo.us</a>. Because I allready use scriptticolumous in the web site i decided to use scriptaulimoumus but I still don&#8217;t know how to spell it or read (always have to search on google.com that he corrects my misspelling).</p>
<p><span id="more-13"></span></p>
<p>After like an half an hour reading i tried to use the toggle function. And some code which i would write would look like:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_49277832437c8">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_49277832437c8').style.display='block';document.getElementById('plain_synthi_49277832437c8').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<form>
<table width=&#034;100%&#034; border=&#034;0&#034; cellspacing=&#034;0&#034; cellpadding=&#034;0&#034;>
<tr>
<td>
<input type=&#034;checkbox&#034; name=&#034;checkMeToSeHiddenFields&#034; id=&#034;checkMeToSeHiddenFields&#034; onclick=&#034;Effect.toggle('content_to_show', 'slide')&#034;> Click me to see something</td>
</tr>
<tr>
<td>
<div id=&#034;content_to_show&#034; style=&#034;display:none&#034;>
<div>
<input type=&#034;text&#034; name=&#034;noname&#034; /></div>
</div>
</td>
</tr>
<tr>
<td>
<input type=&#034;submit&#034; value=&#034;submit&#034; /></td>
</tr>
</table>
</form>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_49277832437c8">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_49277832437c8').style.display='block';document.getElementById('styled_synthi_49277832437c8').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;Effect.toggle(&#8217;content_to_show&#8217;, &#8217;slide&#8217;)&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> Click me to see something<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;content_to_show&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display:none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;noname&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
<p>I think this is pretty straight forward. What it does, on the beginning the checkbox is not checked and the div is not shown so if you would click on the checkbox it would be checked and the layer would be shown. Basiclly it works, if you are smart and with no adrenalin and no stress. But for me no way, as soon as i see something to click i would click on it like 5 billion times a second to make it crash or to relax. So after clicking a few million times i saw that the checkbox was checked but the div was not shown and some more million clicks the checkbox was not checked and the div was shown. :-( no shit. </p>
<h3>2. Scenario 22:30(some more cigarets and &#8230;)</h3>
<p>What now? I decided to handle the toggle function on my own. Now the new code:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_49277832ba607">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_49277832ba607').style.display='block';document.getElementById('plain_synthi_49277832ba607').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<script type=&#034;text/javascript&#034;>
function toggleSomeEffect() {
	if($('checkMeToSeHiddenFields').checked == true) { // the checkbox to check
		if($('content_to_show').visible()) { // if the div is visible do nothing

		} else { // else show the div.
			Effect.SlideDown('content_to_show');
		}
	} else { // not checked so dont show it
		if($('content_to_show').visible()) { // if div visible hide it
			Effect.SlideUp('content_to_show');
		}
	}
}
</script>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_49277832ba607">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_49277832ba607').style.display='block';document.getElementById('styled_synthi_49277832ba607').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">&quot;text/javascript&quot;</span>&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> toggleSomeEffect<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;checkMeToSeHiddenFields&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">checked</span> == <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// the checkbox to check</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// if the div is visible do nothing</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// else show the div.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// not checked so dont show it</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// if div visible hide it</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
<div class="synthi_code" style="display:none;" id ="plain_synthi_49277832c90f2">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_49277832c90f2').style.display='block';document.getElementById('plain_synthi_49277832c90f2').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<form>
<table width=&#034;100%&#034; border=&#034;0&#034; cellspacing=&#034;0&#034; cellpadding=&#034;0&#034;>
<tr>
<td>
<input type=&#034;checkbox&#034; name=&#034;checkMeToSeHiddenFields&#034; id=&#034;checkMeToSeHiddenFields&#034; onclick=&#034;toggleSomeEffect()&#034;> Click me to see something</td>
</tr>
<tr>
<td>
<div id=&#034;content_to_show&#034; style=&#034;display:none&#034;>
<div>
<input type=&#034;text&#034; name=&#034;noname&#034; /></div>
</div>
</td>
</tr>
<tr>
<td>
<input type=&#034;submit&#034; value=&#034;submit&#034; /></td>
</tr>
</table>
</form>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_49277832c90f2">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_49277832c90f2').style.display='block';document.getElementById('styled_synthi_49277832c90f2').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;toggleSomeEffect()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> Click me to see something<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;content_to_show&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display:none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;noname&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;submit&quot;</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tr&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/table&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
<p>I thought this might work and started to click on it 5 billion times a second same thing they are not syncronized as they should be. :-( kiss my ass.</p>
<h3>3. Scenario 11:50 (more smoke)</h3>
<p>There are some more smaller in scenarios in the story but will just skip them not make it so exciting huh. So i decided to make a fuse which would tell me if everything is allready done. So this is the last one.</p>
<p>I started to read the callback functions and found beforeStart and afterFinish. So would before start make a variable true and after finish make the variable false. In that way i would know when i could make another Effect call. in the afterFinish callback function i would also implement a checking for the checkbox which would tell me if it is checked or not and show the div or not. In this way they will be always syncronized.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_492778334a5ef">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_492778334a5ef').style.display='block';document.getElementById('plain_synthi_492778334a5ef').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<script type=&#034;text/javascript&#034;>
var finito = true; // our fuse variable

function beforeStartCallMe(obj) { // this gives you the div object obj.
	finito = false; // we started an Effect.
}

function afterFinishCallMe(obj) {
	finito = true; // the effect is finished.
	if($('checkMeToSeHiddenFields').checked == true) { // if checked.
		if($('content_to_show').visible() == false) { // and div not visible
			Effect.SlideDown('content_to_show', {beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe});
		}
	} else {
		if($('content_to_show').visible()) { // if visible div but not checked checkbox
			Effect.SlideUp('content_to_show', {beforeStart:beforeStartCallMe, afterFinish: afterFinishCallMe});
		}
	}
}

function toggleSomeEffect() {
	if($('checkMeToSeHiddenFields').checked == true) {		
		if($('content_to_show').visible()) {
		} else {
			if(finito) {
				Effect.SlideDown('content_to_show', {beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe});
			}
		}
	} else {
		if($('content_to_show').visible() &#038;&#038; finito) {
			Effect.SlideUp('content_to_show', {beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe});
		}
	}
}
</script>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_492778334a5ef">
<div class="synthi_header" style="font-weight:bold;"> JAVASCRIPT <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_492778334a5ef').style.display='block';document.getElementById('styled_synthi_492778334a5ef').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="javascript" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color: #3366CC;">&quot;text/javascript&quot;</span>&gt;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> finito = <span style="color: #003366; font-weight: bold;">true</span>; <span style="color: #009900; font-style: italic;">// our fuse variable</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> beforeStartCallMe<span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// this gives you the div object obj.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; finito = <span style="color: #003366; font-weight: bold;">false</span>; <span style="color: #009900; font-style: italic;">// we started an Effect.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> afterFinishCallMe<span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; finito = <span style="color: #003366; font-weight: bold;">true</span>; <span style="color: #009900; font-style: italic;">// the effect is finished.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;checkMeToSeHiddenFields&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">checked</span> == <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// if checked.</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #003366; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// and div not visible</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span>, <span style="color: #66cc66;">&#123;</span>beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">// if visible div but not checked checkbox</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span>, <span style="color: #66cc66;">&#123;</span>beforeStart:beforeStartCallMe, afterFinish: afterFinishCallMe<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> toggleSomeEffect<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;checkMeToSeHiddenFields&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">checked</span> == <span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>finito<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span>, <span style="color: #66cc66;">&#123;</span>beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">visible</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; finito<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Effect.<span style="color: #006600;">SlideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&#8216;content_to_show&#8217;</span>, <span style="color: #66cc66;">&#123;</span>beforeStart: beforeStartCallMe, afterFinish: afterFinishCallMe<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
<div class="synthi_code" style="display:none;" id ="plain_synthi_492778337065a">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_492778337065a').style.display='block';document.getElementById('plain_synthi_492778337065a').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
<form>
<table width=&#034;100%&#034; border=&#034;0&#034; cellspacing=&#034;0&#034; cellpadding=&#034;0&#034;>
<tr>
<td>
<input type=&#034;checkbox&#034; name=&#034;checkMeToSeHiddenFields&#034; id=&#034;checkMeToSeHiddenFields&#034; onclick=&#034;toggleSomeEffect()&#034;> Click me to see something</td>
</tr>
<tr>
<td>
<div id=&#034;content_to_show&#034; style=&#034;display:none&#034;>
<div>
<input type=&#034;text&#034; name=&#034;noname&#034; /></div>
</div>
</td>
</tr>
<tr>
<td>
<input type=&#034;submit&#034; value=&#034;submit&#034; /></td>
</tr>
</table>
</form>
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_492778337065a">
<div class="synthi_header" style="font-weight:bold;"> HTML <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_492778337065a').style.display='block';document.getElementById('styled_synthi_492778337065a').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="html4strict" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">&lt;table</span></a> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">border</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellspacing</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellpadding</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">&lt;tr&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;checkMeToSeHiddenFields&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;toggleSomeEffect()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> Click me to see something<span style="color: