<?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>UnDeprived &#187; Web Dev</title>
	<atom:link href="http://www.un-deprived.com/category/webdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.un-deprived.com</link>
	<description>A webdev journal of the Moninator</description>
	<lastBuildDate>Thu, 29 Jul 2010 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Git — get it running on a remote server in 5 steps… really the easy way — not kidding</title>
		<link>http://www.un-deprived.com/2010/webdev/git-get-it-running-on-a-remote-server-in-5-steps-really-the-easy-way-not-kidding/</link>
		<comments>http://www.un-deprived.com/2010/webdev/git-get-it-running-on-a-remote-server-in-5-steps-really-the-easy-way-not-kidding/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 04:16:57 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[.gitignore]]></category>
		<category><![CDATA[SSH key]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=623</guid>
		<description><![CDATA[I’ve known subervsion for a while, I didn’t use it that because I’m like a one-person-web-army, so I didn’t find the use for it and used Bazzar – which you could do version control by folder and with a nice GUI built in. The only reason I didn’t do a full blown version control with [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I’ve known subervsion for a while, I didn’t use it that because I’m like a one-person-web-army, so I didn’t find the use for it and used Bazzar – which you could do version control by folder and with a nice GUI built in. The only reason I didn’t do a full blown version control with Bazzar was that there weren’t a lot of free hosts that host Bazzar and I didn’t feel like installing one.</p>
<h2>Why Git &gt; Subversion – a short intro</h2>
<p>Subversion is like a tourist bus, everyone has to get there at the same time and check in, if one’s missing – oh crap.  If the bus crapped out, you ain’t going anywhere either. Git is like a rental car, you check in when you’re done using it. If your car broke down, you can replace it with another. I thought this anthology makes sense if you want to visualize it.</p>
<p>Back to the nerd terms, here’s what they are. So finally, I just started a new job that I actually work in a team that use Subversion. It’s great and all, I still don’t like it as much.  Biggest problem as people know is Subversion is a centralized version control system, if the server is down, so are you. Well, not completely, you work on your local copy, when the server is back up, there will be A LOT OF messed up merging to do because it <em>can’t</em> keep tracks of what you’ve done up to that certain point.  You are actually wasting time.  Not to mention it has its own file structure, it’s pretty “tidy” in a way. If you work like a mess like me, Bazzar and Git are our heroes. Git is pretty much like Bazzar, that you can do version control in ANYWHERE you want.  You don’t have to have to let a server knows what you are doing in every 5 minutes to keep things in check, you can just do it locally.  So imagine the server goes down for an hour, in that one hour you drew a nice looking dragon from your whatever, colorized it, added wings etc… and commit each of the change. When the server comes back up.  You tell the Subversion server, hey, I did these. The server goes… what the hell are these craps?? I knew NOTHING about the dragon… it reminds me of my dad kicked my ass one time while I tried to explain why I didn’t do my homeworks, because they were READING ASSIGNMENTS!!!  Now THAT’S a git!</p>
<p>Instead, Git tracks them all offline, so if the server goes down, who cares.  When it’s back up, you can tell the server what you’ve done, how many changes you’ve made, you drew a dragon, added some flames etc… the server WILL know what you did and so will everyone else because it keeps track all the versions offline. So when you “push”, you are actually uploading the old AND the new versions to the server.  Better yet, if the server goes down in flames, you can just find another one, upload what you have and all good to go again. Imagine the Subversion server goes down in flames… I can’t… I just can’t!  I don’t wanna think how to recover all of my awesome dragons!  I lied, you can, just not with all the versions you’ve made. Just need to start a new one… me thinks…</p>
<h2>Okay okay, here’s the 5 steps to setup Git to a remote server</h2>
<p>Enough dragons, I’ve read at least 20 blogs, 10 docs to piece together how people can make the simple setup process hard.  It’s not hard, but they’re just not on the same page for some odd reasons.  For the record, NOT everyone uses <a href="http://github.com" target="_blank">Github</a>… I use <a href="http://unfuddle.com" target="_blank">unfuddle</a></p>
<ol>
<li>Sign up an account on either Github or Unfuddle</li>
<li>Go to <a href="http://git-scm.com/download" target="_blank">Git-scm.com</a>‘s download page to get <a href="http://code.google.com/p/msysgit/" target="_blank">msysGit</a> (full version to make things simple – not the portable one) - just follow the steps for installation… then it’ll ask you Select <em>either</em> <strong>Git Bash</strong> or <strong>Windows Command </strong>- I’m not that smart, but I prefer to look smart, so I chose Git Bash over windows cmd. It’s just like windows cmd anyways with a few nerd commands.</li>
<li>For remote hosts such as Unfuddle or Github – they’ll need a SSH key to authenticate the connection to their servers.  Each computer needs a new key, so if you are home, needs one. At work, needs one. At your ex’s house stealing his stuff, needs one. Without it, you can’t get in, simple as that. So let’s get that out of the way first. So let’s do this the easy way without typing much.
<p>Open up Windows Explorer, find a folder, really, <em>any </em>folder, right click on it and you’ll see “Git GUI here” – click on it. You’ll see a box come up.  Click “Help” -&gt; “Show SSH Key”.  If you see a blank box – click on “Generate key” (<a href="http://www.un-deprived.com/wp-content/uploads/ssh-key.jpg" rel="lightbox[623]">Screenshot</a>).  Copy all of that to:</p>
<ul>
<li> <strong>Github </strong>-&gt; Account Settings -&gt; it’ll nag you if you don’t have a SSH key added yet. So add it.</li>
<li> <strong>Unfuddle </strong>-&gt; Personal Settings (top right) -&gt; Scroll down you’ll find the box then paste all of it in also (give it a name if you want – I do Home, Work)</li>
</ul>
</li>
<li>For the purpose of learning, I highly recommend using Git Bash – if you learn the commands, you’ll understand how to use Git GUI later.  First, go to the folder that you would like to start version control (just use your windows explorer) – then right click <strong>on the folder</strong> “Git Bash here”.  A linux command prompt thingy pops up.</li>
<li>Create an new repository on Github or Unfuddle
<ul>
<li><strong>Github</strong>: believe it or not, Github gives you ALL of the instructions you need!  So just type what they show you, then you’re good to go!</li>
<li><strong>Unfuddle</strong>: same for unfuddle but they won’t show it to your face. After you’ve created a new repo, click on “Repositories” – you’ll see the new repo you just created, click on it then you’ll see the instructions.</li>
</ul>
</li>
</ol>
<p>Really, that’s all to it for setting up a new repo server to work with, but for someone who don’t know much about command prompts / shells stuff, it was hard and I’m sure someone else out there had the same problem.</p>
<h3>What gives?! Remote hangs???</h3>
<p>If you see “Remote hang” – two possibilities:</p>
<ol>
<li>You need to wait for the SSH key a bit longer (if you didn’t do it in step 3 – which should give it enough time, if not, wait a few more minutes)</li>
<li>You’ve entered a password when you created a SSH Key. So if this happens, make sure you leave the password fields empty.  If you use Git Bash to generate the key, just hit enter twice when it ask for password. When you’re done, add the SSH-Key back in <strong>step 3 – </strong>wait a minute a two then try again.</li>
</ol>
<h2>Ignoring Files</h2>
<p>Along the path, I’ve asked the same question and it took some diggings to find.  If you have a few files you want to do version control, but want to skip files like .DS_Store, .project, .fla or whatever.</p>
<h3><strong>Ignore Files Way #1</strong></h3>
<ol>
<li>During “git add .” – instead of doing that.  Just do:<br />
<code>git add filename.html filename.jpg</code><br />
You can add as many files on one line as you wish – DON’T commit yet</li>
<li>Type “git status” – you’ll see a list of “untracked files” – make sure those are the files that you DON’T want to track (version control)</li>
<li>Then type:<br />
<code>git ls-files -o --exclude-standard &gt;&gt; .gitignore</code> </p>
<p>What this does is it will ignore all the files those were showed in “untracked” – then create the .gitignore file for you</li>
<li>After you’re done: “git add .gitignore” then commit</li>
</ol>
<h3><strong>Ignore Files Way #2:</strong></h3>
<ol>
<li>Fire up notepad and add the file names that you want to ignore. Example:<br />
.project<br />
.DS_store<br />
whatever.jpg</li>
<li>Save the file <em>inside</em> the <strong>same </strong>folder where you just initiated a Git and name it ignorefiles.txt (or whatever you want – something simple)</li>
<li>Open up or switch back to Git Bash – assuming that you didn’t change directory and didn’t close it (otherwise, just go back to the folder and do a “Git Bash here”). Type “ls” to see if “ignorefiles.txt” is there.  If not, make sure you save the file here.  Otherwise, type the following to change the file name to “.gitignore”:<br />
<code>mv ignorefiles.txt .gitignore<br />
git add .gitignore<br />
git commit -m "Added .gitignore"</code></li>
</ol>
<p>You would say why not just change the file extension inside Windows Explorer? Well, go try it, then you’ll see why. I’ll wait……… Done? Worded. As you can see, way #1 is easier.  If you did way #1, and want to add more files later, it created the .gitignore automatically for you, so just double click on it and point it to Notepad to open it up.  Or Git Bash it…</p>
<h2>Remove Files from Tracking</h2>
<p>One more thing I found myself wondered was how the heck do I remove one of the files after it got tracked?? Simple:<br />
<code>git rm --cached filename</code><br />
I’ve seen people tell others to do: <em>git rm filename</em></p>
<p>That will delete your file for you, too! Did they even read the question??  I prefer removing it then add to the ignore list, I don’t feel safe removing a file physically even though I got Git to watch my back.</p>
<p>Anyways, these are the stuff I’ve ran into when I first trying to setup my workspace, hope this helps.  Once you’ve finished this, you’re pretty much up and running.  Refer to:  <a href="http://git-scm.com/documentation">http://git-scm.com/documentation</a> for tons of goodies info.<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2010/webdev/git-get-it-running-on-a-remote-server-in-5-steps-really-the-easy-way-not-kidding/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Tread lightly when using Zimplit</title>
		<link>http://www.un-deprived.com/2010/webdev/tread-lightly-when-using-zimplit/</link>
		<comments>http://www.un-deprived.com/2010/webdev/tread-lightly-when-using-zimplit/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 22:52:37 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=544</guid>
		<description><![CDATA[I love Zimplit‘s simple idea, and relatively easy to setup (depending on server’s configurations). But of course it comes with a head-scratcher. Here are what I learned: 1. Localhost Timeout Error As many sane developer would do, you want to test almost everything on a Local server if you’re using Xampp Lite. I have been [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://zimplit.com/" target="_blank">Zimplit</a>‘s simple idea, and relatively easy to setup (depending on server’s configurations). But of course it comes with a head-scratcher. Here are what I learned:</p>
<h3>1. Localhost Timeout Error</h3>
<p>As many sane developer would do, you want to test almost everything on a Local server if you’re using Xampp Lite. I have been experiencing timeout error. Maybe it’s due to the firewall at work, but I  am going to investigate more using a full verison of the Xampp server</p>
<h3>2. “public_html” vs “www” Folders</h3>
<p>This may sounds crazy, but I think it might have something to do with the configurations of the server. I tried uploading to my own server, everything works fine. But I couldn’t get it working on my client’s server, it couldn’t CHMOD properly. Crazy enough, I deleted everything and re-uploaded everything to the public_html folder, CHMOD the proper files, then it worked… I know both folders are basically the same thing, but why it happened the way it did, CRAZY! I tell you. So I’m going to try to reproduce this “bug” if it is even a bug or just me…</p>
<h3>3. jQuery + zimplit = Site Explosion!</h3>
<p>Unfortunately, today I found out zimplit will blow up your some parts of your layout if you have some sorts of scripting going on in the background, such as slideshow, hidden divs. As soon as you insert an editable area, it automatically inserts its own div and classes inside ALL OF YOUR DIVs! Drove me insane for over an hour why my simple page stopped working with a simple slideshow.  I mean it’s not the end of the world, you just have to rework your CSS to fit it in. But it would be nice IF SOMEONE TOLD ME BEFOREHAND!!</p>
<p>Overall, zimplit is still an awesome idea, but it’s quite intrusive. It works well if you have a very simple website or planned ahead to use it at the beginning. If you decide to implement <em>afterward</em>, it is much more difficult because you’ll probably have to rework lots of CSS. But I think I will try my hands on it again next time when I build a site from scratch.  Just my 2 cents.<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2010/webdev/tread-lightly-when-using-zimplit/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Image maps within an image map</title>
		<link>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/</link>
		<comments>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 15:36:07 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[homepage]]></category>
		<category><![CDATA[hotspots]]></category>
		<category><![CDATA[image maps]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[new things]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=526</guid>
		<description><![CDATA[I finally launched the never-ending homepage redesign project yesterday for my company, so far so good, not everything I want, but at least got what my bosses want. I didn’t like the way how it was put together, but I had fun scripting with jQuery once again. This time, he wants to do “wipe up” [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.un-deprived.com/wp-content/uploads/eq2010screenshot.jpg" rel="lightbox[526]" title="Equus 2010 Homepage"><img src="http://www.un-deprived.com/wp-content/uploads/eq2010screenshot-226x124.jpg" alt="Equus 2010 Homepage" title="Equus 2010 Homepage" width="226" height="124" class="alignnone size-medium wp-image-525" /></a></p>
<p>I finally launched the never-ending homepage redesign project yesterday for my company, so far so good, not everything I want, but at least got what my bosses want. I didn’t like the way how it was put together, but I had fun scripting with jQuery once again. This time, he wants to do “wipe up” sort of effects and he resisted that me HTML-ing the hidden contents because he wants it “the way it is” for the contents. *dies* So I’m stuck with image maps… the loading time on the page is “glorious” to say the least… hey… I do what I asked of me. He didn’t want to hear loading time,  the web standards, best practices, and stuff like that. Although, I added the helpful image preloader plugin to speed things up just a bit, better than nothing. Over the course of the project, I’ve learned some little interesting things…</p>
<p><strong>Interesting things I’ve learned…</strong></p>
<ol>
<li>If you add “padding” around an image that has “hotspots” over it; IE (no matter what version)  WILL  offset the coordinates by the padding – the “hotspots” will be off by the amount of padding you put around the image. But in Firefox, the image map hotspots behave the way it should be. So if you need to adjust the spacing of the images when using image maps, use “margins”, don’t use “padding”. Took me a short while to figure this out…</li>
<li>Relative + absolute positions will snap pictures in any corner you want. In my case, I wanted the image to be lower left corner to achieve the “wiping” effect – otherwise, it’ll just “slide” the image out if you don’t absolute position it.
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">  	&lt;div style=&quot;position:relative&quot;&gt;
    	&lt;div style=&quot;position: absolute; bottom: 0; left: 0;&quot;&gt;Image here&lt;/div&gt;
    &lt;/div&gt;</pre>
</div>
</div>
</li>
<li>Too many image map hotspots is like Freddie Cougar’s face… ugly as hell and a freaking nightmare</li>
<li>jQuery $.each() saved  pounds of my hair once again</li>
<li>Do not add negative padding inside a jQuery.animate() – it will crash like a 100 cars pile-up on a highway…</li>
<li>Don’t try to explain to my boss why adding <em>more</em> image hotspots <em>inside</em> an image map is such a bad idea – he looks at me funny and starts getting pissy</li>
</ol>
<p>Besides all the pain and suffering for a month,  the most fun I got out of this project was scripting the animations and solving the “image map within an image map” problem. Here’s the run-down of the project:</p>
<ol>
<li>There will be main menu at the bottom of the screen, when the user hovers over each of time, the corresponding content (the image) will “wipe up” – I am calling this Tier 1 menu
<ol>
<li>Now “wiping” and “sliding” are two different animals, and my mini-boss <em>specifically</em> wants “wiping”, not “sliding”. So I had quite a bit of fun trying to make the image contents “wipe” up</li>
<li>Solution: create a “wrapper” div that wraps all the hidden “content images” – default the “wrapper” to 0px, then use jQuery to animate the height of the “Wrapper” to the full height when hover over. So I basically created a “mask” to do this hide the images. Attach the corresponding image, show, then “wipe” up</li>
</ol>
</li>
<li>Each of those image will have image map hotspots (no problem here)  </li>
<li>Within Tier 1 menu’s contents, one of the contents has multiple links within it and has a Tier 2 menu – better yet, the Tier 2 menu has four sub-contents WITH DIFFERENT unique image maps…</li>
</ol>
<p><strong>The Problem</strong></p>
<p>The problem? If you use the same map for all the images, they will have other hotspots showing up in images that you don’t want. Let’s say Image A is using #map1,  Image B needs to have the same menu but has different hotspot links. When Image B  uses #map1 again, well, all the hotspots intended for Image A will also  shows up. Of course, the obvious solution is to have multiple maps. The problem is the Tier 2 Menu shows/hides its contents. So if you have multiple maps, the Tier 2 Menu won’t able to hide and show content accordingly unless you want to code each of the Tier 2 menu with its own little script. Repetitive, inefficient, and probably won’t work.</p>
<p><strong>The Solution(s)</strong></p>
<p>After losing a couple hundreds of my hair, the solution? Create separate image maps for each of the unique hotspots map. So Image A gets its own map, Image B etc… use jQuery to clone the map according to the active menu and attach to the the “main map” (#map1), add a temporary class, and then remove them when the user hovers over a different menu item. Meaning: #map1 is the Tier 2 main menu and is defaulted to Image A. #map1 has the Tier 2 main menu, and the rest has its own unique hotspots maps <em>without</em> the Tier 2 Menu. Let’s say Image C has unique hotspot links, so when the user hovers over Image C. jQuery will tell this Image C to append #map3 hotspots (&lt;area&gt;) to #map1. When the user hovers to a different one, it removes all the previously attached “hotspots” – I identified them by adding a dummy class in each of the attached &lt;area&gt; map, then append another set if needed. Painful, but not bad for a workaround I think.</p>
<p>I find front-end development is like solving puzzles, and I love solving puzzles especially when it involves jQuery. Well, that’s it folks.</p>
<p><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2010/webdev/image-maps-within-an-image-map/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>New Portfolio</title>
		<link>http://www.un-deprived.com/2009/webdev/new-portfolio/</link>
		<comments>http://www.un-deprived.com/2009/webdev/new-portfolio/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 02:23:31 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Graphic]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[designloper]]></category>
		<category><![CDATA[portfolio]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=416</guid>
		<description><![CDATA[I finally gathered my braincells and launched my new portfolio: Designloper.com today: I was trying to “brand” myself in a way, what’s better than a made-up word that describes perfectly of what I do, right?  I love the lime green colors, but I thought it was getting too boring with the light gray and white. [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I finally gathered my braincells and launched my new portfolio: <a title="Designloper" href="http://designloper.com" target="_blank">Designloper.com</a> today:</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/designloper2.jpg" rel="lightbox[416]" title="Designloper.com"><img class="alignnone size-full wp-image-417" title="Designloper.com" src="http://www.un-deprived.com/wp-content/uploads/designloper2.jpg" alt="Designloper.com" width="336" height="253" /></a></p>
<p>I was trying to “brand” myself in a way, what’s better than a made-up word that describes perfectly of what I do, right?  I love the lime green colors, but I thought it was getting too boring with the light gray and white.</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/html.jpg" rel="lightbox[416]" title="mludesign"><img class="alignnone size-full wp-image-422" title="mludesign" src="http://www.un-deprived.com/wp-content/uploads/html.jpg" alt="mludesign" width="322" height="353" /></a></p>
<p>So I spiced things up this time with dark brown and hot pink.  I was loving the fun colors as I was designing, it looked almost “hippy” which fits my personalities – I never did drugs in my life, but I seem so…<span id="more-416"></span></p>
<p>At the moment, it’s still in Beta with basic functions, hoping to AJAX-fy it in the next few days.  Right now, it is xHTML 1.0 Transitional validated, and with only TWO hacks to make IE6 looks pretty.  So I was very thrilled that it turned out well and only with minimal hack works needed to be done with IE6.</p>
<p>So <a title="Designloper" href="http://designloper.com/" target="_blank">check it out</a>, and please give me feed backs!<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/new-portfolio/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>jQuery CSV2Table — Modified</title>
		<link>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/</link>
		<comments>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 23:02:10 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[CSV2Table]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jquery Journal]]></category>
		<category><![CDATA[jQuery Plugins]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=399</guid>
		<description><![CDATA[Version in this article: jQuery 1.3.2 / CSV2Table 0.03-b-2.9 Lately I started to like CSV (Common Separated Values) more and more comparing to XML.XML is a pain to setup even as entering data, then grabbing the data requires Einstein’s brain plus 3 sleepless and hair-pulling days of coding… okay, I maybe exaggerated a bit, but [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Version in this article: jQuery 1.3.2 / CSV2Table 0.03-b-2.9</p>
<p>Lately I started to like CSV (Common Separated Values) more and more comparing to XML.XML is a pain to setup even as entering data, then grabbing the data requires Einstein’s brain plus 3  sleepless and hair-pulling days of coding… okay, I maybe exaggerated a bit, but that’s how I feel about XML. My first encounter with CSV was InDesign, in there, you can import a bunch of data and generates PDF like Word’s Mail Merge feature. Then one day, someone asked me if I can find a better and easier way to help the non web people to maintain a site. I started out with search terms like “jQuery read text files” or something like that, one of the results returned as using CSV and there is a plugin called <a href="http://jsgt.org/lib/jquery/plugin/csv2table/v002/test.htm" target="_blank">CSV2Table</a> in the jQuery Plugins website by Toshiro Takahashi written earlier this year. Testing… <span id="more-399"></span>testing… and hot damned! It’s like magic!!!</p>
<p>The awesome thing about CSV is you can enter all the data using Excel, then simply save the file as something.csv and it’s ready to be used. No stupid header &lt;xml&gt;&lt;/xml&gt; tags, inner tags, child tags or whatever the heck tags. Just simple data. If you really, really want to be fancy; you can even add HTML such as &lt;img&gt; – believe it not, it worked like a charm. Although, it’s silly to format your CSV data within while you have your hands on the god-awsome jQuery framework to manipulate all of those data. Then to generate the table, all you simply have to do is:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#div&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">csv2table</span><span style="color: #009900;">&#40;</span>csvfile<span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span> <span style="color: #339933;">&lt;</span>em<span style="color: #339933;">&gt;</span>options<span style="color: #339933;">&lt;/</span>em<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Well, I’m not going to get into the <em>options</em> detail but you can refer back to the <a href="http://jsgt.org/lib/jquery/plugin/csv2table/v002/test.htm#nview0" target="_blank">CSV2Table docs</a>. You can manipulate how the data display, format, colorize, draw a dragon or whatever. This plugin is very flexible when it comes to formatting the results. Some people describe me as lazy, but I like to describe myself as “efficient” because I don’t like to repeat myself or do extra work. So it doesn’t make sense to write the code above everytime I need to reuse it, that’s just not the Mon’s way, here’s Mon’s way:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	<span style="color: #003366; font-weight: bold;">function</span> csvReader<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">,</span>csvfile<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span>container<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">csv2table</span><span style="color: #009900;">&#40;</span>csvfile<span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
				sortable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				removeDoubleQuote <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				nowloadingMsg<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Loading &quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; eblasts archive...&quot;</span><span style="color: #339933;">,</span>
				errorMsg <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Error loading &quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; eBlasts archive. Archive either doesn't exist or renamed. Please contact Mon (mlu@equuscs.com) for support.&quot;</span><span style="color: #339933;">,</span>
				<span style="color: #000066;">onload</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>ary<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#totalEblasts&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>ary.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Display the total rows of the eblasts</span>
					$<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">+</span><span style="color: #3366CC;">' tr:even'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'#efefef'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Every even row gets colorized</span>
					$<span style="color: #009900;">&#40;</span>container<span style="color: #339933;">+</span><span style="color: #3366CC;">' th'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;text-align&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;left&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Just setting the TH rows will be left aligned</span>
				 <span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>I wrote a function that because I know I’m going to reuse the code to load the <em>exact</em> same data, just maybe the CSV file or the DIV container might be different. Instead of writing re-writing again. If I ever need it, all I have to do is:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	csvReader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#csvContainer&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;data.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Done. Now, you probably wonder, what the heck did I use it for? Well, see screenshot:</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/csv.jpg" rel="lightbox[399]" title="csv"><img class="alignnone size-medium wp-image-400" title="csv" src="http://www.un-deprived.com/wp-content/uploads/csv-171x125.jpg" alt="csv" width="171" height="125" /></a></p>
<p>So when the user clicks on “View Archive”, it loads a new CSV file like this:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#selectYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">live</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    csvReader<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#csv&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;eblasts/&quot;</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#eblastsYear&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.csv&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>Less work = better. One  minor thing I felt missing was when the file is missing or failed to load, it just get stuck on the default “Now loading” message. I dug under the hood of the CSV2table codes, it uses $.get() to process the data which doesn’t really can tell whether the XHR request was successful or not; nor it can detect it unless you add the ajax.error() handle. So I’ve decided to change it to using the actual $.ajax() to call the data, and detect if there is a 404 error, it’ll display an error message accordingly instead of just “Loading…” – while I was at it, I felt, well, I and I’m pretty sure most people want to customize their sucessful load and error messages, right? So I added two more settings inside the plugin which are: <em>nowloadingMsg</em> and <em>errorMsg.</em> If you are so darn lazy and don’t want to customize it, it defaults to  “Now loading…” (fades out) and “CSV file not found.”. Here’s the modifications:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	op <span style="color: #339933;">=</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
			url                <span style="color: #339933;">:</span> url<span style="color: #339933;">,</span>
			nowloadingImg      <span style="color: #339933;">:</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">loadImg</span><span style="color: #339933;">,</span>              <span style="color: #006600; font-style: italic;">//Image of now loading...</span>
			nowloadingMsg      <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>     						   <span style="color: #006600; font-style: italic;">//Message of now loading...</span>
			errorMsg		   <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>							   <span style="color: #006600; font-style: italic;">//Error Message</span>
       	<span style="color: #006600; font-style: italic;">// The rest of the codes...</span></pre>
</div>
</div>
<p>Do a search for “op.nowloadImg” and you’ll see “$.get()”.  I modified as follow around line 130 if you added what’s above:</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	<span style="color: #006600; font-style: italic;">//Default loading message if not set in settings</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">nowloadingMsg</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> op.<span style="color: #660066;">nowloadingMsg</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Now loading...&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
    $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">before</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'
&lt;div class=&quot;csv2table-loading&quot;&gt;&lt;img src=&quot;'</span><span style="color: #339933;">+</span>op.<span style="color: #660066;">nowloadingImg</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; alt=&quot;&quot; /&gt; '</span><span style="color: #339933;">+</span>op.<span style="color: #660066;">nowloadingMsg</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&lt;/div&gt;
'</span> <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Default error message</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">errorMsg</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> op.<span style="color: #660066;">errorMsg</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;CSV file not found.&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
       type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
       url<span style="color: #339933;">:</span> url<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;?&quot;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
       data<span style="color: #339933;">:</span> $.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
       success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span>textSatus<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;display&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>mkRowsAry<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         setCSS<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $<span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api_type</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart:line'</span><span style="color: #009900;">&#41;</span>op.<span style="color: #660066;">type</span><span style="color: #339933;">=</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'line'</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">use_api_type</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'jqchart:bar'</span><span style="color: #009900;">&#41;</span>op.<span style="color: #660066;">type</span><span style="color: #339933;">=</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">type</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'bar'</span><span style="color: #339933;">;</span>
            useChart<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>$.<span style="color: #660066;">csv2table</span>._rowsAry<span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">onload</span><span style="color: #009900;">&#41;</span>$.<span style="color: #660066;">csv2table</span>.<span style="color: #660066;">setting</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">onload</span><span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>op<span style="color: #339933;">,</span>data<span style="color: #339933;">,</span>$.<span style="color: #660066;">csv2table</span>._rowsAry<span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
       error <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>xhr<span style="color: #339933;">,</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>xhr.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">404</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// page not found</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.csv2table-loading&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;csv2table_error&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>op.<span style="color: #660066;">errorMsg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</div>
</div>
<p>To sum it up for the CSV2Table mod, these are the changes I’ve made:</p>
<ul>
<li>2 extra settings: nowloadingMsg / errorMsg (defaults to “Now loading…” and “CSV file not found.”)</li>
<li>Changed $.get() method to $.ajax()</li>
<li>Added 1 extra CSS class: csv2table_error</li>
</ul>
<p>My modded: <a href='http://www.un-deprived.com/wp-content/uploads/jquery.csv2table-mod.js'>jquery.csv2table-mod</a><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/jquery-csv2table-modified/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Pods CMS: Magic Tag</title>
		<link>http://www.un-deprived.com/2009/webdev/pods-cms-magic-tag/</link>
		<comments>http://www.un-deprived.com/2009/webdev/pods-cms-magic-tag/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 12:32:48 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Pods CMS]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[Magic Tags]]></category>
		<category><![CDATA[PICK column]]></category>
		<category><![CDATA[pods]]></category>
		<category><![CDATA[pods cms]]></category>
		<category><![CDATA[wordpress plugins]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=357</guid>
		<description><![CDATA[This is going to be a short post. Magic Tags are very awesome, but on the Pods CMS documentation failed to mention something very simple yet useful. Before anything, here’s a quick run down of what Magic Tags are… Software Note: Pods CMS 1.7.3 / WP 2.8.4 Documentation: http://pods.uproot.us/codex/magic_tags What are Magic Tags From Pods [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>This is going to be a short post. Magic Tags are very awesome, but on the Pods CMS documentation failed to mention something very simple yet useful. Before anything, here’s a quick run down of what Magic Tags are…</p>
<p><span id="more-357"></span></p>
<p><strong>Software Note</strong>: <a href='http://pods.uproot.us/' target='_blank'>Pods CMS</a> 1.7.3 / WP 2.8.4</p>
<p><strong>Documentation</strong>: <a href="http://pods.uproot.us/codex/magic_tags">http://pods.uproot.us/codex/magic_tags</a></p>
<p><strong>What are Magic Tags</strong></p>
<p>From Pods CMS’ documentation: Magic Tags are used exclusively within <strong>Pod templates</strong> to dynamically pull in column values.</p>
<p><strong>Usage:</strong> {@column_name} / {@column_name,display_helper}</p>
<p><strong>In addition to the documentation:</strong> {@column_name.another_column_name}</p>
<p>The above method allow you access a different Pod’s columns when it is a PICK column inside a pod.</p>
<p>Let’s say you have to two pods. The <em>Person</em> pod, and<em> Country</em> pod. The <em>Person </em>pod has a PICK column of the <em>Country</em> pod to identify the nationality of that person, and you want to list all the people as: Person’s Name, Country (where you want to access by: <a href="http://domain.com/person">http://domain.com/person</a>). So inside the <strong>Pod Templates</strong> you would have something like this to show:</p>



<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;{@name}, {@country}&lt;/p&gt;</pre></div></div>


<p>The above displays something like below on the <em> Person</em> list page (<em><a href="http://domain.com/person">http://domain.com/person</a></em>): </p>



<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Mon Lu, United States
John Smith, Canada
Ken Yamamoto, Japan</pre></div></div>


<p>Now you want to get a bit sophisticated that you want to link the person’s name to its own detail page, and the country is linked to its own page listing all the people from that country or something like that. Not only that, you want to link the page using its own slugs/permalinks like this: <em><a href="http://domain.com/person/mon_lu">http://domain.com/person/mon_lu</a></em> and <em><a href="http://domain.com/country/usa">http://domain.com/country/usa</a></em> – assuming you have a  column named <em>slug</em> in the <em>Person</em> pod, and or <em> abbrv</em> in the <em>Country</em> pod. Before I figured this out, I used a <a href="/2009/webdev/pods-cms-display-helpers/">Display Helper</a> to grab the <em>abbrv</em> from the <em>Country </em>pod. But the easier way is the following, assuming this is still <em><a href="http://domain.com/person">http://domain.com/person</a></em> listing all the people where the <em>Country</em> pod is a PICK column inside the <em>Person</em> pod:</p>



<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;&lt;a href=&quot;/person/{@slug}&quot;&gt;{@name}&lt;/a&gt;&lt;a href=&quot;/country/{@country.abbrv}&quot;&gt;{@country}&lt;/a&gt;&lt;/p&gt;</pre></div></div>


<p>Simple enough, yeah? </p>
<p><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/pods-cms-magic-tag/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Pods CMS — Input Helpers</title>
		<link>http://www.un-deprived.com/2009/webdev/pods-cms-input-helpers/</link>
		<comments>http://www.un-deprived.com/2009/webdev/pods-cms-input-helpers/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 22:31:41 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Pods CMS]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[input helper]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PICK column]]></category>
		<category><![CDATA[pods cms]]></category>
		<category><![CDATA[wordpress plugins]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=339</guid>
		<description><![CDATA[Software note: Pods CMS Version 1.7.3 / WP 2.8.4 Documentation: http://pods.uproot.us/codex/helpers What are Input Helpers An Input Helper lets you completely customize the appearance of any input field… when adding new data contents. In plain n00b English: as an example, the default field “name” I had it to store last names, and a separate column [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p><strong>Software note:</strong> <a href='http://pods.uproot.us/' target='_blank'>Pods CMS</a> Version 1.7.3 / WP 2.8.4</p>
<p><strong>Documentation:</strong> <a href="http://pods.uproot.us/codex/helpers">http://pods.uproot.us/codex/helpers</a></p>
<p><strong>What are Input Helpers</strong></p>
<p>An Input Helper lets you completely customize the appearance of any input field… when adding new data contents. </p>
<p><strong>In plain n00b English:</strong> as an example, the default field “name” I had it to store last names, and a separate column to store first names (fname). The problem of that would be when you’re using Bi-directional relationship PICK column to another Pod (let’s call this: Person) is you can only relate <em>one of the columns</em>, not both First Name and Last Name. So if you use the PICK column the “name”; which stores the Last Names, and with the last name like <em>Johnson</em> – you probably can’t tell which Johnson that is. Input Helpers can grab and display the full names for you when you’re adding data. <span id="more-339"></span>See screenshot:</p>
<p><img src='http://www.un-deprived.com/wp-content/uploads/2009/09/input-helper-fullname.jpg' alt='input-helper-fullname' width="197" height="135" align='none' class='alignnone' /></p>
<p><strong>How to add a new Input Helper</strong></p>
<p><img src='http://www.un-deprived.com/wp-content/uploads/2009/09/add-new-helper.jpg' alt='add-new-helper' width="584" height="201" align='none' class='alignnone' /></p>
<p><strong>Customized Dropdown Input Helper</strong></p>
<p>The following refers back to the example and screenshot above where it pulls full names from the “name” and “fname”columns as a PICK column to display as a drop down menu:</p>



<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;select class=&quot;form pick1 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
        &lt;option value=&quot;&quot;&gt;-- Select one --&lt;/option&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$lastname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$firstname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$fullname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$lastname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$firstname</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$selected</span> <span style="color: #339933;">=</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">''</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">' selected'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$selected</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$fullname</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/select&gt;</pre></td></tr></table></div>


<p><strong>The crucial parts: </strong></p>



<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;select class=&quot;form pick1 &lt;?php echo $name; ?&gt;&quot;&gt;</pre></div></div>


<p>The <strong>class</strong> “form pick1″ are required by the default CSS unless you don’t care about the CSS. The $name is just an column’s name to identify the column’s name.  Just like <strong><a href='/2009/webdev/pods-cms-display-helpers/'>Display Helper</a></strong>, it passes the $value array for you to manipulate. The rest of the codes are very straight forward to read through the $value array, make sure that it actually have something in it before reading it. Then split it in parts to display. The $select is simply default select whatever previous selected when you are browsing existing content. If you’re adding new content, it is default to “–Select one–”. The very last part of this script is just simply displaying each option, giving each of them their unique row ID, then finally displaying the full names. </p>
<p>Another one I ran into was when I want to do a Multi PICK column, such as people who belong to a Dojo or Federation. See below:</p>
<p><img src='http://www.un-deprived.com/wp-content/uploads/2009/09/input-helper-fullname2.jpg' alt='input-helper-fullname2' width="273" height="170" align='none' class='alignnone' /><br />
I referenced the code above, with the help of FireBug, this saved the day:</p>
<p><strong>Customized Multi PICK Column Input Helper</strong></p>



<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;form pick <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$lastname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$firstname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$fullname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$lastname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$firstname</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$active</span><span style="color: #339933;">=</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">''</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">' active'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
       &lt;div class=&quot;option<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$active</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$fullname</span> <span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre>
</td>
</tr>
</table>
</div>
<p>As you’ve noticed, there are only minor differences between the two. The differences are “div” instead of “select”, $active, and the very last line (line 12).  Obviously the very last line is the default CSS that used by Pods CMS for Multi PICK columns, unless you want something different.</p>
<p><strong>Using the helpers</strong></p>
<p>Simply click on the pencil/Edit icon of the column, and choose the helper.  Like this:</p>
<p><img src='http://www.un-deprived.com/wp-content/uploads/using-input-helper.jpg' alt='using-input-helper' width="368" height="417" align='none' class='alignnone' /></p>
<p>Well, that’s it for now. I’ll update this section if I learn more.</p>
<p><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/pods-cms-input-helpers/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Pods CMS — Display Helpers</title>
		<link>http://www.un-deprived.com/2009/webdev/pods-cms-display-helpers/</link>
		<comments>http://www.un-deprived.com/2009/webdev/pods-cms-display-helpers/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 17:31:23 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Pods CMS]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[pods cms]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress plugins]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=291</guid>
		<description><![CDATA[I’ve been very silent on Facebook, Twitter, and this blog lately. That because I can’t constantly access Twitter anymore from work, they blocked me… so no more useful stuff to tweet and brag about excepted one thing: Pods CMS. Pods CMS is a WordPress plugin that pretty much turn your blog into a CMS. You [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I’ve been very silent on Facebook, Twitter, and this blog lately.  That because I can’t constantly access Twitter anymore from work, they blocked me… so no more useful stuff to tweet and brag about excepted one thing: <a title="Pods CMS" href="http://pods.uproot.us/" target="_blank">Pods CMS</a>.  Pods CMS is a WordPress plugin that pretty much turn your blog into a CMS.  You can build a Wiki, Glossary, Recipes, Hotel listing etc… the possibilities are endless.  Although, you will need to know at least some PHP to make this thing tuned to the way you want it to be.  I have been playing with it in the past 2 weeks, I have to say I am very impress of how this plugin works. So I did a test on one of my hobbies: Kendo.  I’ve always wanted to collect data on Kendo Dojo, how many practitioners, and Kendo tournament results in the U.S.  I was able to create this very complex database that it can be listed by Federations, State, Country, Dojo, and down to the individual Kendo-ist data.  The awesome thing is?  Each listing can be linked to one another.  For example, if you viewing by Federations, you can list all the Dojo in that federation, and with links to each Dojo AND the state.  You can add BUILT-IN filters and search on top!  The backend is all done for you, all you have to do is to make things pretty.  Ain’t that grant?</p>
<p><span id="more-291"></span></p>
<p>The problem of this awesome plugin that it is quite new, the documentations, tutorials, and resources are quite limited.  But the developers are extremely helpful on <a href="http://pods.uproot.us/forums/" target="_top">their own forum</a> – so you’ll have to do a lot of digging to find the answers you need… in which I did.  I also found the tutorials were kind of half way done, they stopped at displaying the data, but not showing how to write simple Display Helper and Input Helper.  So I’m going to jog that down here.</p>
<p>If you have not gone through the <a href="http://pods.uproot.us/codex/" target="_blank">documentations</a> and have some basic data to play with, you should get going (thinking putting one simple guide of how to put all the pods together later).</p>
<p><strong>Disclaimer:</strong></p>
<p>The following helpers are very basic ones that I found myself used them a lot and repeatedly, so hopefully these will be useful for someone else also.  On a side note that I am NOT a hardcore PHP coder, I understood enough basic PHP codes to customize them. If you know a better way, feel free.</p>
<p>So let’s get rolling…</p>
<p><strong>Software Note</strong>: Pods CMS 1.7.3 / WP 2.8.4</p>
<p><strong>Documentation</strong>: <a href="http://pods.uproot.us/codex/helpers">http://pods.uproot.us/codex/helpers</a></p>
<p><strong>Display Helpers:</strong> Display Helpers are the codes that help to display your results in a nicer, customized look.  For example, say that you want to show all of your ingredients in a recipe, by default, they’ll be list as such: “Ingredient 1Ingredient 2″ – it is hard to read.  So you can write a Display Helper to show them as “Ingredient 1, Ingredient 2″.  Got it?</p>
<p>By default, the Display Helper passes $value as an array for you to manipulate as such: $value[0][’column_name’].  </p>
<p><strong>Adding a Display Helper</strong></p>
<p>Adding a new Display Helper is very simple, see below:</p>
<div id="attachment_292" class="wp-caption alignnone" style="width: 373px"><a href="http://www.un-deprived.com/wp-content/uploads/2009/09/add-new-helper.jpg" rel="lightbox[291]" title="Pods CMS - Add new Display Helper"><img class="size-medium wp-image-292" title="Pods CMS - Add new Display Helper" src="http://www.un-deprived.com/wp-content/uploads/2009/09/add-new-helper-363x124.jpg" alt="Pods CMS - Add new Display Helper" width="363" height="124" /></a>
<p class="wp-caption-text">Pods CMS – Add new Display Helper</p>
</div>
<p><strong>List Single Result ONLY (No Link)</strong></p>
<p>Add a new <strong>Display Helper</strong> and name this one something like “print_r”:</p>
<div class="wp_syntax">
<div class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</div>
</div>
<p>I have these two generic Display Helpers displaying a <em>single </em>result only.  By default, if you having something like {@column_name}, it will show column’s name and it is linked to a its own detailed page (if it is bi-directional), something like (<a href="http://domain.com/your_pod/column_name/1">http://domain.com/your_pod/column_name/1</a>).  Where the very last part is actually the row ID.  So what if you want to display your data with a custom permalink/slug?  Such as: (<a href="http://domain.com/your_pod/slug_name">http://domain.com/your_pod/slug_name</a>)  This helper will come in handy in your <strong>Pod Templates</strong> page:</p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family:monospace;">&lt;a href=&quot;/pod_name/{@slug}&quot;&gt;{@column_name,print_r}&lt;/a&gt;</pre>
</div>
</div>
<p>You probably noticed that I put the helpers right next to the Magic Tags instead of adding the Display Helpers like this:</p>
<div id="attachment_298" class="wp-caption alignnone" style="width: 101px"><a href="http://www.un-deprived.com/wp-content/uploads/2009/09/display-helper-dd.jpg" rel="lightbox[291]" title="display-helper-dropdown"><img class="size-medium wp-image-298" title="display-helper-dropdown" src="http://www.un-deprived.com/wp-content/uploads/2009/09/display-helper-dd-91x125.jpg" alt="Display Helper " width="91" height="125" /></a>
<p class="wp-caption-text">Display Helper </p>
</div>
<p>It’s a matter of personal preference really.  If you want, you can add the helper inside the admin interface.  If you’d rather add the Display Helper through the admin interface, you don’t need to add “print_r” inside {@print_r}.</p>
<p><strong>Displaying Arrays</strong></p>
<p>The following will display “Ingredient 1, Ingredient 2, Ingredient 3″ instead of “Ingredient 1Ingredient 2Ingredient 3″ with links or no link to your liking:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$pod</span> <span style="color: #339933;">=</span> pods_url_variable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'first'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$output</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;a href='/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pod</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'slug'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' /&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No record found&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
</td>
</tr>
</table>
</div>
<p>If you just want to display the results without the links, simply remove the “href” on line 8.</p>
<p><strong>Note:</strong> This helper will only link to current pod, what I mean: “/<em>pod1</em>/slugname”, but not able to link “/<em>pod2</em>/slugname”. The reason is that this script will only grab the pod’s name which is “/pod1″ and add itself to the “a href…”.  If you want to link to a different pod, you’ll just have to add a new helper with a minor change of instead of ‘$pod’ (line 8 ) where the “a href…” is to your actual pod’s name, make sense?</p>
<p>Well, that’s it for now… next up, <a href='/2009/webdev/pods-cms-input-helpers/'>Input Helper</a>.<!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/pods-cms-display-helpers/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Javascript: Pick a random number starting from 1</title>
		<link>http://www.un-deprived.com/2009/webdev/javascript-pick-a-random-number-starting-from-1/</link>
		<comments>http://www.un-deprived.com/2009/webdev/javascript-pick-a-random-number-starting-from-1/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 18:11:03 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[random number]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=253</guid>
		<description><![CDATA[Quickie note, a very simple script to pick a random number between 1–5, instead of 0–4 var rand = Math.floor&#40;Math.random&#40;&#41;*5&#41;; if&#40;rand &#38;gt; 0&#41;&#123; rand = rand+1; alert&#40;rand&#41;; &#125; else &#123; rand = 1; alert&#40;rand&#41;; &#125; No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Quickie note, a very simple script to pick a random number between 1–5, instead of 0–4</p>
<div class="wp_syntax">
<div class="code">
<pre class="javascript" style="font-family:monospace;">	<span style="color: #003366; font-weight: bold;">var</span> rand <span style="color: #339933;">=</span> Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>rand <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		rand <span style="color: #339933;">=</span> rand<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>rand<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		rand <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>rand<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/webdev/javascript-pick-a-random-number-starting-from-1/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Using Actionscript 2.0 to pause frames</title>
		<link>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/</link>
		<comments>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 15:29:03 +0000</pubDate>
		<dc:creator>Mon</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[Actionscripts]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[movie clips]]></category>
		<category><![CDATA[pause]]></category>

		<guid isPermaLink="false">http://www.un-deprived.com/?p=244</guid>
		<description><![CDATA[…and controls to pause and play the time line. I’ve been using this script quite a bit, and I think it’s time to jog it down somewhere. A few things to keep in mind when using this script: Try not to use this script on the main/root time line. If you have movie clips within [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>…and controls to pause and play the time line.</p>
<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/08/thumb.jpg" rel="lightbox[244]" title="thumb"><img class="alignnone size-medium wp-image-246" title="thumb" src="http://www.un-deprived.com/wp-content/uploads/2009/08/thumb-301x125.jpg" alt="thumb" width="301" height="125" /></a></p>
<p>I’ve been using this script quite a bit, and I think it’s time to jog it down somewhere. A few things to keep in mind when using this script:<span id="more-244"></span></p>
<ol>
<li>Try not to use this script on the main/root time line. If you have movie clips within the main timeline, when the timer is up, it speeds through the entire time line to the every end. Stop(); won’t do anything.</li>
<li>This script works well inside a movie clip, also works for movie clips within a movie clip. But try to minimize it to only one clip</li>
<li>The controls (Pause, Play) buttons work best in the main / root time line, doesn’t work too well if there are clips within a clip</li>
</ol>
<p>Just insert the following inside a <em>movie clip’s time line</em> where you want it to pauses for a few moments:</p>
<div class="wp_syntax">
<div class="code">
<pre class="actionscript" style="font-family:monospace;">	 <span style="color: #0066CC;">stop</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">var</span> startTime:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">var</span> pausedTime = <span style="color: #cc66cc;">0</span>;
    <span style="color: #808080; font-style: italic;">//countTo = number of seconds.</span>
    <span style="color: #000000; font-weight: bold;">var</span> countTo:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">10</span>;
    <span style="color: #000000; font-weight: bold;">var</span> ref:<span style="color: #0066CC;">MovieClip</span> = <span style="color: #0066CC;">this</span>;
&nbsp;
    <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">onEnterFrame</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>paused<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> elapsedTime:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-ref.<span style="color: #006600;">startTime</span>-pausedTime;
            <span style="color: #000000; font-weight: bold;">var</span> count:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">ceil</span><span style="color: #66cc66;">&#40;</span>countTo-<span style="color: #66cc66;">&#40;</span>elapsedTime<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">0.001</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>count<span style="color: #66cc66;">&amp;</span>lt;<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">nextFrame</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre>
</div>
</div>
<p>In addition if you want to have Pause / Play buttons, insert the following codes after the above codes:</p>
<div class="wp_syntax">
<div class="code">
<pre class="actionscript" style="font-family:monospace;">	<span style="color: #0066CC;">_root</span>.<span style="color: #006600;">puz1</span>.<span style="color: #0066CC;">onRelease</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
       <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>paused<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          pauseTime = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
          paused=<span style="color: #000000; font-weight: bold;">true</span>;
          <span style="color: #0066CC;">_root</span>.<span style="color: #006600;">puz1</span>.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;
       <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #0066CC;">_root</span>.<span style="color: #006600;">play1</span>.<span style="color: #0066CC;">onRelease</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
       <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>paused<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          pausedTime += <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - pauseTime;
          paused=<span style="color: #000000; font-weight: bold;">false</span>;
          <span style="color: #0066CC;">_root</span>.<span style="color: #006600;">puz1</span>.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
       <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre>
</div>
</div>
<p><a href="http://www.un-deprived.com/wp-content/uploads/2009/08/timeline.jpg" rel="lightbox[244]" title="timeline"><img class="alignnone size-medium wp-image-248" title="timeline" src="http://www.un-deprived.com/wp-content/uploads/2009/08/timeline-151x125.jpg" alt="timeline" width="151" height="125" /></a><!-- PHP 5.x --></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.un-deprived.com/2009/others/using-actionscript-2-0-to-pause-frames/feed/</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
	</channel>
</rss>
