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

<channel>
	<title>plasticular inscriptor &#187; php</title>
	<atom:link href="http://www.plasticstare.com/plains/category/coding/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.plasticstare.com/plains</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Delicious for WordPress</title>
		<link>http://www.plasticstare.com/plains/2008/03/30/delicious-for-wordpress/</link>
		<comments>http://www.plasticstare.com/plains/2008/03/30/delicious-for-wordpress/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 23:50:06 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[downloadable]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2008/03/30/delicious-for-wordpress/</guid>
		<description><![CDATA[Props to Rick for this simple way for adding recent delicious bookmark postings to your wordpress sidebar. Download Delicious for WordPress here: http://rick.jinlabs.com/code/delicious/ It was the simplest way I could find to do this. It isn&#8217;t customizable, other than editing the code yourself, but it does a great job out of the box, and does [...]]]></description>
			<content:encoded><![CDATA[<p>Props to <a href="http://rick.jinlabs.com/code/delicious/" title="delicious for wordpress" target="_blank">Rick</a> for this simple way for adding recent delicious bookmark postings to your wordpress sidebar. Download Delicious for WordPress here: <a href="http://rick.jinlabs.com/code/delicious/" title="delicious for wordpress" target="_blank">http://rick.jinlabs.com/code/delicious/</a></p>
<p>It was the simplest way I could find to do this. It isn&#8217;t customizable, other than editing the code yourself, but it does a great job out of the box, and does pretty much what you would want it to do anyway, which is post things to your blog that you found interesting, without having to actually write a post about it&#8230;hooray for industrious laziness!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/03/30/delicious-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hierarchical Menu Traversal for the Ppl</title>
		<link>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/</link>
		<comments>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/#comments</comments>
		<pubDate>Tue, 16 May 2006 00:05:15 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=78</guid>
		<description><![CDATA[Well, as it was the most productive part of my day today, I decided to go ahead and impart it to the web. I'm sure there are plenty of examples out there...but I might as well use it as a tutorial for those who might need it. Its not rocket-science, but for those who haven't [...]]]></description>
			<content:encoded><![CDATA[<p>Well, as it was the most productive part of my day today, I decided to go ahead and impart it to the web. I'm sure there are plenty of examples out there...but I might as well use it as a tutorial for those who might need it. Its not rocket-science, but for those who haven't really used it before, its kind of foreign.</p>
<p>[*NOTE: for the code below, you may want to click the permalink link at the bottom of the article - I haven't had time yet to set up my style sheets to have this look correct (i.e. some of the code is getting cut off on the right)...]</p>
<p>A co-worker had a friend who was looking to traverse hierarchical menu data and print it out in PHP and needed a quick thought-jump-start, so I gave him the following algorithm. The code I've included below is actually more in AS 2.0 format, but its just the syntax that differs from PHP.</p>
<p>The idea is that there is a heirarchical menu sort of like this:</p>
<p>Menu 1<br />
     Submenu 1<br />
          Subsubmenu 1<br />
          Subsubmenu 2<br />
     Submenu 2<br />
Menu 2<br />
Menu 3</p>
<p>...and this menu is currently bundled into an object array (for my example) that could have been parsed from XML. My example below gives each menu a "value," which is the text of the menu, such as "File" and also gives each menu a menu of its own, called here by name as "children."</p>
<p>An example of this menu in object syntax is as follows:</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showCodeTxt('code-3'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu1"</span>,children:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Submenu1"</span>,children:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Subsubmenu1"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Subsubmenu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Submenu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu2"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span>value:<span style="color:#CC0000;">"Menu3"</span>,children:<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically, the challenge for most people is just making that leap to get their head around how to traverse any number of submenu levels, since in the structure above, any submenu item can have its own submenus. The key to doing this lies in using a recursive function call (if you are unfamiliar you can just look up "recursion" on Google or Wikipedia). What the recursion allows you to do is define a situation in which the function calls itself with a new set of data, which is perfect for our hierarchical menu object.  Basically we want to print the menu values out, but if a menu has submenus, then we also want to print them out (and perhaps indent them). The AS 2.0 code for this is as follows:</p>
<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showCodeTxt('actionscript-4'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-4">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// printMenus :&nbsp; recursive function for printing the menu</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> printMenus <span style="color: #66cc66;">&#40;</span>clist, prefixString<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;color:#800000;">0</span>;nlength;n++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">print</span> <span style="color: #66cc66;">&#40;</span>prefixString + <span style="color: #ff0000;">"•"</span> + clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<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>clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">children</span>.<span style="color: #006600;">length</span>&gt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printMenus<span style="color: #66cc66;">&#40;</span> clist<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">children</span>,<span style="color: #66cc66;">&#40;</span>prefixString + <span style="color: #ff0000;">"&nbsp; &nbsp; &nbsp;"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<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;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #808080; font-style: italic;">// end for loop</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// now print it</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">printMenus<span style="color: #66cc66;">&#40;</span>myMenuList, <span style="color: #ff0000;">""</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Please note that above I am using a hypothetical function called "print" to do the printing. In Flash, you could just use "trace" instead of "print" to see the results. Basically, the function is called, and the menu list (myMenuList here would be perhaps the object from above) and an initial indent of "" is passed in. As the menu is printed out, it checks to see if there are any menu children. If there are, the function calls itself again, this time with an augmented indention string. The function as it runs basically "drills down" the structure as far as it finds objects with children. I will say, however, that one needs to be careful how they use this in Flash, as I believe it still has a limit for the number of recursions that can be performed in a given period of time. Also, importantly, the variable "n" used as the index in the for loop must be scoped locally so that each time the function calls itself, a different local instance of a variable "n" gets used to do the loop. Hope this helps someone out there...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/05/15/hierarchical-menu-traversal-for-the-ppl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deyel PHP Photogallery Updated</title>
		<link>http://www.plasticstare.com/plains/2005/11/28/deyel-php-photogallery-updated/</link>
		<comments>http://www.plasticstare.com/plains/2005/11/28/deyel-php-photogallery-updated/#comments</comments>
		<pubDate>Tue, 29 Nov 2005 01:44:53 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plasticware]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=61</guid>
		<description><![CDATA[I finally got around to making some changes to the Deyel PHP photogallery. Using the template.inc class/script from the open-source PHPLib project, Deyel now utilizes templates to display its data, further moving the presentation part of the code away from the data part. In addition, the code has also been updated to utilize part of [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to making some changes to the <a href="http://www.plasticstare.com/deyel/">Deyel</a> PHP photogallery. Using the template.inc class/script from the open-source PHPLib project, Deyel now utilizes templates to display its data, further moving the presentation part of the code away from the data part. In addition, the code has also been updated to utilize part of the image file names as a way of displaying the device used to take the photo, in addition to the date on which it was taken. (The gallery now features photos taken using the Sony-Ericsson T300, the Samsung SCH-a670, and the Palm Zire 71.) A few other under-the-hood improvements were also made. The random photo on the index page of this blog was generated using the Deyel application. The next requested feature is the ability to annotate individual images (possibly in the upcoming month or so...).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2005/11/28/deyel-php-photogallery-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

