<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Codegenius</title>
	<atom:link href="http://codegenius.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codegenius.wordpress.com</link>
	<description>My diary towards a genius coder</description>
	<lastBuildDate>Sun, 11 Apr 2010 03:02:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codegenius.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Codegenius</title>
		<link>http://codegenius.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codegenius.wordpress.com/osd.xml" title="Codegenius" />
	<atom:link rel='hub' href='http://codegenius.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Creating An IPhone Compatible Sweetcron Theme</title>
		<link>http://codegenius.wordpress.com/2009/01/19/creating-an-iphone-compatible-sweetcron-theme/</link>
		<comments>http://codegenius.wordpress.com/2009/01/19/creating-an-iphone-compatible-sweetcron-theme/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 15:28:55 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[sweetcron theme]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=118</guid>
		<description><![CDATA[If you ever wanted to create a sweetcron theme that can be viewed in both computer browser and iphone browser differently, this some tips for you. Viewport Meta Meta tag The viewport meta tag enable the web developer to set the initial scale, minimum scale and maximum scale of the web page. The user-scalable parameter [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=118&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;">
<div id="attachment_144" class="wp-caption aligncenter" style="width: 401px"><img class="size-full wp-image-144" title="IPhone Compatible Sweetcron Theme" src="http://codegenius.files.wordpress.com/2009/01/picture-4.png?w=470" alt="IPhone Compatible Sweetcron Theme"   /><p class="wp-caption-text">IPhone Compatible Sweetcron Theme</p></div>
<p>If you ever wanted to create a <strong>sweetcron theme</strong> that can be viewed in both computer browser and <strong>iphone</strong> browser differently, this some tips for you.<span id="more-118"></span></p>
<p><span style="text-decoration:underline;"><strong>Viewport Meta Meta tag</strong></span></p>
<p>The viewport meta tag enable the web developer to set the initial scale, minimum scale and maximum scale of the web page. The user-scalable parameter in the meta tag can be used to turn user scaling on/off</p>
<blockquote><p>&lt;<span style="color:#0000ff;">meta</span> <span style="color:#0000ff;">name</span>=&#8221;<span style="color:#008000;">viewport</span>&#8221; <span style="color:#0000ff;">content</span>=&#8221;<span style="color:#008000;">width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;</span>&#8221; /&gt;</p></blockquote>
<p>the viewport meta tag shown above set the content width to device width, its initial scale, minimum scale and maximum scale to 1.0 (original scale) and turn off the user scaling. The meta tag can be added inside the html header of the page.</p>
<p><strong><span style="text-decoration:underline;">Conditional CSS</span></strong></p>
<p>You can use conditional CSS to create different layouts for specific platforms and mobile devices. Using CSS3 media queries, you can add iPhone-specific style sheets to your webpage without affecting how your webpages are rendered on other platforms.</p>
<p>CSS3 recognizes several media types, including print, handheld, and screen. iPhone ignores print and handheld media queries because these types do not supply high-end web content. Therefore, use the screen media type query for iPhone.</p>
<p>To specify a style sheet that is just for iPhone without affecting other devices, use the <code>only</code> keyword in combination with the <code>screen</code> keyword in your HTML file. Older browsers ignore the <code>only</code> keyword and won’t read your iPhone style sheet. Use <code>device-width</code>, <code>max-device-width</code>, and <code>min-device-width</code> to describe the screen size.</p>
<p>For example, to specify a style sheet for iPhone, use the following expression:</p>
<blockquote><p>&lt;<span style="color:#0000ff;">link</span> <span style="color:#0000ff;">media</span>=&#8221;<span style="color:#339966;">only screen and (max-device-width: 480px)</span>&#8221; <span style="color:#0000ff;">href</span>=&#8221;<span style="color:#339966;">small-device.css</span>&#8221; <span style="color:#0000ff;">type</span>= &#8220;<span style="color:#339966;">text/css</span>&#8221; <span style="color:#0000ff;">rel</span>=&#8221;<span style="color:#339966;">stylesheet</span>&#8220;&gt;</p></blockquote>
<p>to specify a style sheet for devices other than iphone, use the following expression:</p>
<blockquote><p>&lt;<span style="color:#0000ff;">link</span> <span style="color:#0000ff;">media</span>=&#8221;<span style="color:#339966;">screen and (min-device-width: 481px)</span>&#8221; <span style="color:#0000ff;">href</span>=&#8221;<span style="color:#339966;">not-small-device.css</span>&#8221; <span style="color:#0000ff;">type</span>=&#8221;<span style="color:#339966;">text/css</span>&#8221; <span style="color:#0000ff;">rel</span>=&#8221;<span style="color:#339966;">stylesheet</span>&#8220;&gt;</p></blockquote>
<p><span style="text-decoration:underline;"><strong>User Agent String</strong></span></p>
<p>Different browser will have different user agent string. The user agent string will be stored inside the variable <span style="color:#000000;">$_SERVER</span>['<span style="color:#339966;">HTTP_USER_AGENT</span>']. Shown below are the user agent string for IPhone and IPod Touch:</p>
<p>IPhone:</p>
<blockquote><p><em>Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/XXXXX Safari/525.20</em></p></blockquote>
<p>IPod Touch:</p>
<blockquote><p><em>Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3</em></p></blockquote>
<p>We can utilize the user agent string to output different html for the IPhone/IPod Touch browser. For example, I changed the content of sweetcron _header.php to have only this line:</p>
<p><span style="color:#ff0000;">&lt;?php</span> <span style="color:#0000ff;">if </span>(<span style="color:#800000;">stristr</span>($_SERVER['<span style="color:#339966;">HTTP_USER_AGENT</span>'], &#8220;<span style="color:#339966;">iPhone</span>&#8220;)){</p>
<p style="padding-left:30px;"><span style="color:#000000;">$this</span>-&gt;load-&gt;view(&#8216;<span style="color:#339966;">themes/</span>&#8216;.$this-&gt;config-&gt;item(&#8216;<span style="color:#339966;">theme</span>&#8216;).&#8217;<span style="color:#339966;">/_header-iphone</span>&#8216;)</p>
<p>}<span style="color:#0000ff;">else</span>{</p>
<p style="padding-left:30px;">$this-&gt;load-&gt;view(&#8216;<span style="color:#339966;">themes/</span>&#8216;.$this-&gt;config-&gt;item(&#8216;<span style="color:#339966;">theme</span>&#8216;).&#8217;/<span style="color:#339966;">_header-normal</span>&#8216;)</p>
<p>} <span style="color:#ff0000;">?&gt;</span></p>
<p>The above line of code signify that, If the webpage is viewed from iphone the header file that will be used is <span style="color:#339966;">_header-</span><span style="color:#339966;">iphone</span><span style="color:#339966;">.php, <span style="color:#000000;">else, </span><span style="color:#000000;"> </span></span><span style="color:#339966;">_header-normal.php <span style="color:#000000;">will be used. The same method can be applied to the <span style="color:#339966;">items.php</span>, <span style="color:#339966;">_footer.php</span> and <span style="color:#339966;">single.php.</span></span></span></p>
<p><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="text-decoration:underline;"><strong>Javascript</strong></span></span></span></span></span></p>
<p><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;">We can use javascript to change the html view when the iphone orientation is changing:</span></span></span></span></p>
<p><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">function</span> <span style="color:#000080;">updateOrientation</span>(){</span></span></span></span></p>
<p style="padding-left:30px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">var</span> orientation=<span style="color:#3366ff;">window</span>.orientation</span></span></span></span></p>
<p style="padding-left:30px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">switch</span>(orientation){</span></span></span></span></p>
<p style="padding-left:60px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">case</span> 0:</span></span></span></span></p>
<p style="padding-left:90px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#008000;">//potrait mode</span><br />
<span style="color:#0000ff;">break</span>;</span></span></span></span></p>
<p style="padding-left:60px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">case</span> 90:</span></span></span></span></p>
<p style="padding-left:90px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#008000;">//landscape left mode</span></span></span></span></span></p>
<p style="padding-left:90px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">break</span>;</span></span></span></span></p>
<p style="padding-left:60px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#0000ff;">case</span> -90: </span></span></span></span></p>
<p style="padding-left:90px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#008000;">//landscape right mode</span><br />
<span style="color:#0000ff;">break</span>;</span></span></span></span></p>
<p style="padding-left:30px;"><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;">}</span></span></span></span></p>
<p><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;">}<br />
<span style="color:#008000;">// execute the updateOrientation function when iPhone switches between portrait and landscape modes</span>.<br />
<span style="color:#3366ff;">window</span>.onorientationchange=updateOrientation;</span></span></span></span></p>
<p><span style="text-decoration:underline;"><strong>IPhone Integration</strong></span></p>
<p>The major problem when we want to view sweetcron page inside the IPhone is, IPhone cannot show the youtube video. So, in order to solve that problem, we can use IPhone integration. We can integrate the youtube link with the IPhone&#8217;s internal youtube viewer. Instead of showing the video inside the web page, we just show the button that links to the youtube video. using the sweetcron syntax:</p>
<blockquote><p>$item-&gt;get_original_permalink()</p></blockquote>
<p>When viewer click on the button/link, the IPhone&#8217;s internal youtube viewer will automatically opened.</p>
<p><span style="color:#339966;"><span style="color:#000000;"><span style="color:#339966;"><span style="color:#000000;"><span style="text-decoration:underline;"><strong>IPhone/IPod Touch Scaling:</strong></span></span></span></span></span></p>
<p>Lastly, we must also know the scaling of the IPhone/IPod Touch screen to design a web page compatible for them. The picture below shows the potrait and landscape scaling.</p>
<div id="attachment_119" class="wp-caption aligncenter" style="width: 480px"><img class="size-full wp-image-119" title="IPhone potrait measurement" src="http://codegenius.files.wordpress.com/2009/01/metricsappledotcom.jpg?w=470&#038;h=430" alt="IPhone potrait measurement" width="470" height="430" /><p class="wp-caption-text">IPhone potrait measurement</p></div>
<div id="attachment_120" class="wp-caption aligncenter" style="width: 480px"><img class="size-full wp-image-120" title="IPhone landscape measurement" src="http://codegenius.files.wordpress.com/2009/01/metricsapplelandscape.jpg?w=470&#038;h=235" alt="IPhone landscape measurement" width="470" height="235" /><p class="wp-caption-text">IPhone landscape measurement</p></div>
<p style="text-align:center;">picture source: <a href="http://developer.apple.com/" target="_blank">http://developer.apple.com/webapps/</a></p>
<p style="text-align:left;">That&#8217;s all for now. If you want to view the IPhone compatible sweeetcron theme in action, have a look at <a href="http://brainstorm.pro/" target="_blank">http://brainstorm.pro/</a>. Try to view it from both the IPhone and Computer browser.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=118&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2009/01/19/creating-an-iphone-compatible-sweetcron-theme/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/picture-4.png" medium="image">
			<media:title type="html">IPhone Compatible Sweetcron Theme</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/metricsappledotcom.jpg" medium="image">
			<media:title type="html">IPhone potrait measurement</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/metricsapplelandscape.jpg" medium="image">
			<media:title type="html">IPhone landscape measurement</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding tinyMCE WYSIWYG In Sweetcron Blog Editor</title>
		<link>http://codegenius.wordpress.com/2009/01/16/adding-tinymce-wysiwyg-in-sweetcron-blog-editor/</link>
		<comments>http://codegenius.wordpress.com/2009/01/16/adding-tinymce-wysiwyg-in-sweetcron-blog-editor/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 08:12:51 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[tinyMCE]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=95</guid>
		<description><![CDATA[In previous post, I have release a multiple user version of sweetcron. One of the sweetest feature on that version is the tinyMCE WYSIWYG blog editor. In this post, I would like to point out how to do that on your already installed sweetcron. Firstly, download the tinyMCE package from here. After finished downloading the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=95&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In previous post, I have release a multiple user version of sweetcron. One of the sweetest feature on that version is the <a href="http://tinymce.moxiecode.com/" target="_blank"><strong>tinyMCE</strong></a> <a href="http://en.wikipedia.org/wiki/WYSIWYG" target="_blank"><strong>WYSIWYG</strong></a> blog editor. In this post, I would like to point out how to do that on your already installed sweetcron.<span id="more-95"></span></p>
<p>Firstly, download the tinyMCE package from <a href="http://tinymce.moxiecode.com/download.php" target="_blank">here</a>.</p>
<p>After finished downloading the package, put the extract jscript folder from the package into the folder <strong></strong></p>
<blockquote><p><strong>sweetcron/system/application/views/admin/ </strong></p></blockquote>
<p>In order to enable the WYSIWYG feature into the blog post editor, we need to add some code in the file:</p>
<blockquote><p><strong>sweetcron/system/application/views/admin/write.php</strong></p></blockquote>
<p>just add <a href="http://brainstorm.pro/downloads/tinyMCE.txt" target="_blank"><strong>this</strong></a> script before the form.</p>
<p>what the code does is initializing the tinyMCE instance with specified mode, theme and plugins. You can modify the arrangement of the tinyMCE toolbar button as you like by modifying the code. for more information on the tinyMCE  go to the tinyMCE homepage:</p>
<blockquote><p><strong>http://tinymce.moxiecode.com/</strong></p></blockquote>
<p>Easy right? enjoy!!</p>
<p><strong>preview:</strong></p>
<p><img class="alignnone size-full wp-image-81" title="picture-3" src="http://codegenius.files.wordpress.com/2009/01/picture-3.png?w=470&#038;h=369" alt="picture-3" width="470" height="369" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=95&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2009/01/16/adding-tinymce-wysiwyg-in-sweetcron-blog-editor/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/picture-3.png" medium="image">
			<media:title type="html">picture-3</media:title>
		</media:content>
	</item>
		<item>
		<title>Multiple User SweetCron Release</title>
		<link>http://codegenius.wordpress.com/2009/01/12/multiple-user-sweetcron-release/</link>
		<comments>http://codegenius.wordpress.com/2009/01/12/multiple-user-sweetcron-release/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 15:31:30 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[multiple user sweetcron]]></category>
		<category><![CDATA[sweetcron option]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=76</guid>
		<description><![CDATA[After giving a lot of thought.. I think that the modification process of sweetcron to enable multiple user is too much to be posted. So, instead of posting the process, I uploaded the finished multiple user sweetcron source files. Some of the changes made are:- multiple user feature twitter plugin also modified to ensure replies [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=76&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After giving a lot of thought.. I think that the modification process of sweetcron to enable multiple user is too much to be posted. So, instead of posting the process, I uploaded the finished multiple user sweetcron source files.<span id="more-76"></span></p>
<p>Some of the changes made are:-</p>
<ul>
<li>multiple user feature</li>
<li>twitter plugin also modified to ensure replies between users on the multiple user group is published.</li>
<li>fixed bugs on blog post pagination (blog posts only show 1 page in the original sweetcron).</li>
<li>fixed bugs on deleted feeds. (deleted feeds is still displayed in the original sweetcron)</li>
<li>added tinyMCE WYSIWYG on WRITE. (So user can add more style on blog post).</li>
<li>added new option: latest blog post limit</li>
<li>still can be used as single user.</li>
</ul>
<p>You can download the source file <a title="Sweetcron Multiple=" href="http://www.brainstorm.pro/downloads/sweetcron%20v1.09b%20(multi-user).zip">here.</a></p>
<p>This is only a beta release. So, if there is any comment or suggestion just tell me.</p>
<p>btw, thank you <a title="Yong Fook's website" href="http://www.yongfook.com/" target="_blank">Yong Fook</a> for releasing such a great application!!</p>
<p><span style="text-decoration:underline;"><strong>Preview:</strong></span></p>

<a href='http://codegenius.wordpress.com/2009/01/12/multiple-user-sweetcron-release/picture-2/' title='picture-2'><img data-attachment-id='80' data-orig-size='607,396' data-liked='0'width="150" height="97" src="http://codegenius.files.wordpress.com/2009/01/picture-2.png?w=150&#038;h=97" class="attachment-thumbnail" alt="picture-2" title="picture-2" /></a>
<a href='http://codegenius.wordpress.com/2009/01/12/multiple-user-sweetcron-release/picture-3/' title='picture-3'><img data-attachment-id='81' data-orig-size='622,489' data-liked='0'width="150" height="117" src="http://codegenius.files.wordpress.com/2009/01/picture-3.png?w=150&#038;h=117" class="attachment-thumbnail" alt="picture-3" title="picture-3" /></a>

<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=76&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2009/01/12/multiple-user-sweetcron-release/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/picture-2.png?w=150" medium="image">
			<media:title type="html">picture-2</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2009/01/picture-3.png?w=150" medium="image">
			<media:title type="html">picture-3</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable Multiple User Feeds In SweetCron (Part 2)</title>
		<link>http://codegenius.wordpress.com/2009/01/05/enable-multiple-user-feeds-in-sweetcron-part-2/</link>
		<comments>http://codegenius.wordpress.com/2009/01/05/enable-multiple-user-feeds-in-sweetcron-part-2/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 03:11:24 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[multiple user sweetcron]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=48</guid>
		<description><![CDATA[In part 1, we have gone through on how to modify the database to enable multiple user in SweetCron. Because the structure of the database has been altered, the next step that we needs to do is to modify the SweetCron model. Model Location: sweetcron/system/application/models Firstly, we need to add a new model which is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=48&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://codegenius.wordpress.com/2009/01/02/multiple-user-sweetcron-part-1/">part 1</a>, we have gone through on how to modify the database to enable multiple user in SweetCron. Because the structure of the database has been altered, the next step that we needs to do is to modify the SweetCron model. <span id="more-48"></span></p>
<p><span style="text-decoration:underline;">Model</span></p>
<p>Location: <span style="color:#ff0000;">sweetcron/system/application/models</span></p>
<p>Firstly, we need to add a new model which is the <em>user_model</em>. This model will be used to access the <em>users</em> table from the database. Like all other models, this model must also inherits from the <em>Model</em> class. The function that we will write in this model are:</p>
<ol>
<li>__construct() <span style="color:#008000;">//class&#8217; constructor</span></li>
<li>_process($users) <span style="color:#008000;">//for final processing of the database result</span></li>
<li>get_all_users() <span style="color:#008000;">//return all existing user</span></li>
<li>add_user($user) <span style="color:#008000;">//add a new user</span></li>
<li>delete_user($user_name) <span style="color:#008000;">//delete user</span></li>
</ol>
<p>After that, we need to modify the <em>feed_model</em> to add a relationship between <em>feeds</em> table and <em>users</em> table. In order to do that, we must join the query result in the accessor functions <em>get_feeds()</em> and <em>get_active_feeds()</em> with the <em>users</em> table. The modified functions should look like as shown below:</p>
<p><span style="color:#0000ff;">function</span><span style="color:#000080;"> <span style="color:#000080;">get_feeds()</span></span><br />
{</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">return</span> <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">_process</span>(<span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">db</span><br />
<span style="color:#0000ff;"> </span></p>
<p style="padding-left:60px;"><span style="color:#0000ff;"><span style="color:#000000;">-&gt;</span><span style="color:#800080;">join</span><span style="color:#000000;">(</span><span style="color:#000000;">&#8216;</span><span style="color:#339966;">users</span><span style="color:#000000;">&#8216;, &#8216;</span><span style="color:#339966;">users.ID = feeds.feed_user_id</span><span style="color:#000000;">&#8216;, &#8216;</span><span style="color:#339966;">left outer</span><span style="color:#000000;">&#8216;</span><span style="color:#000000;">)</span></span></p>
<p style="padding-left:60px;">-&gt;<span style="color:#800080;">result</span>());</p>
<p>}</p>
<p><span style="color:#0000ff;">function</span> <span style="color:#000080;">get_active_feeds</span>(<span style="color:#800080;">$group </span>= <span style="color:#0000ff;">FALSE</span>)<br />
{</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">if</span> (<span style="color:#800080;">$group</span>) {</p>
<p style="padding-left:60px;"><span style="color:#0000ff;">return</span> <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">_process</span>(<span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">db</span></p>
<p style="padding-left:90px;">-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">users</span>&#8216;, <span style="color:#339966;"><span style="color:#000000;">&#8216;</span>users.user_id = feeds.feed_user_id</span>&#8216;, &#8216;<span style="color:#339966;">left outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">group_by</span>(&#8216;<span style="color:#339966;">feed_domain</span>&#8216;)<br />
-&gt;<span style="color:#800080;">get_where</span>(&#8216;<span style="color:#339966;">feeds</span>&#8216;, <span style="color:#0000ff;">array</span>(&#8216;<span style="color:#339966;">feed_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;))<br />
-&gt;<span style="color:#800080;">result</span>());</p>
<p style="padding-left:60px;">} <span style="color:#0000ff;">else</span> {</p>
<p style="padding-left:90px;"><span style="color:#0000ff;">return</span> <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">_process</span>(<span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">db</span></p>
<p style="padding-left:120px;">-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">users</span>&#8216;, &#8216;<span style="color:#339966;">users. user_id = feeds.feed_user_id</span>&#8216;, &#8216;<span style="color:#339966;">left</span> <span style="color:#339966;">outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">get_where</span>(&#8216;<span style="color:#339966;">feeds</span>&#8216;, array(&#8216;<span style="color:#339966;">feed_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;))<br />
-&gt;<span style="color:#800080;">result</span>());</p>
<p style="padding-left:60px;">}</p>
<p style="padding-left:30px;">}</p>
<p>The last model to be modified is the <em>item_model</em>. In this model, we also have to join the query results in all of its accessor functions (get&#8230;()) with the users table. Other than that, we must add 3 new attributes in Sweetcron_Item object declared in the _process($items, $return_single = FALSE) function inside the for loop. The attributes are as shown below:</p>
<p style="padding-left:30px;"><span style="color:#800080;">$new_item</span>-&gt;<span style="color:#800080;">feed_user_id</span> = <span style="color:#800080;">$items</span>[<span style="color:#800080;">$key</span>]-&gt;<span style="color:#800080;">feed_user_id</span>;<br />
<span style="color:#800080;">$new_item</span>-&gt;<span style="color:#800080;">feed_user_name</span> = <span style="color:#800080;">$items</span>[<span style="color:#800080;">$key</span>]-&gt;<span style="color:#800080;">user_login</span>;<br />
<span style="color:#800080;">$new_item</span>-&gt;<span style="color:#800080;">feed_user_avatar</span> = <span style="color:#800080;">$items</span>[<span style="color:#800080;">$key</span>]-&gt;<span style="color:#800080;">user_avatar</span>;</p>
<p>In order to enable viewers to view the feeds for a specific user, we must also add the 2 functions shown below inside the <em>item_model</em></p>
<p><span style="color:#0000ff;">function</span> <span style="color:#000080;">count_items_by_feed_user</span>(<span style="color:#800080;">$feed_user</span>, <span style="color:#800080;">$public</span> = <span style="color:#0000ff;">FALSE</span>){</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">if </span>(<span style="color:#800080;">$public</span>) {</p>
<p style="padding-left:60px;"><span style="color:#800080;">$where</span> = <span style="color:#0000ff;">array</span>(&#8216;<span style="color:#339966;">item_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">publish</span>&#8216;, &#8216;<span style="color:#339966;">user_login</span>&#8216; =&gt; <span style="color:#800080;">$feed_user</span>,&#8217;<span style="color:#339966;">feed_status&#8217;</span> =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;);</p>
<p style="padding-left:30px;">} <span style="color:#0000ff;">else</span> {</p>
<p style="padding-left:60px;"><span style="color:#800080;">$where</span> = <span style="color:#0000ff;">array</span>(&#8216;<span style="color:#339966;">item_status !=</span>&#8216; =&gt; &#8216;<span style="color:#339966;">deleted</span>&#8216;, &#8216;<span style="color:#339966;">user_login</span>&#8216; =&gt; <span style="color:#800080;">$feed_user</span>,&#8217;<span style="color:#339966;">feed_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;);</p>
<p style="padding-left:30px;">}</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">return</span> <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">db</span>-&gt;<span style="color:#800080;">select</span>(&#8216;<span style="color:#339966;">ID</span>&#8216;)<br />
-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">feeds</span>&#8216;, &#8216;<span style="color:#339966;">feeds.feed_id = items.item_feed_id</span>&#8216;, &#8216;<span style="color:#339966;">left outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">users</span>&#8216;, &#8216;<span style="color:#339966;">users.ID = feeds.feed_user_id</span>&#8216;, &#8216;<span style="color:#339966;">left outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">get_where</span>(&#8216;<span style="color:#339966;">items</span>&#8216;, <span style="color:#800080;">$where</span>)<br />
-&gt;<span style="color:#800080;">num_rows</span>();</p>
<p>}</p>
<p><span style="color:#0000ff;">function</span> <span style="color:#000080;">get_items_by_feed_user</span>(<span style="color:#800080;">$offset</span> = 0, <span style="color:#800080;">$limit</span> = 10, <span style="color:#800080;">$feed_user</span>, <span style="color:#800080;">$public</span> = FALSE){</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">if</span> (<span style="color:#800080;">$public</span>) {</p>
<p style="padding-left:60px;"><span style="color:#800080;">$where</span> = <span style="color:#0000ff;">array</span>(&#8216;<span style="color:#339966;">item_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">publish</span>&#8216;, &#8216;<span style="color:#339966;">user_login</span>&#8216; =&gt; <span style="color:#800080;">$feed_user</span>, &#8216;<span style="color:#339966;">feed_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;);</p>
<p style="padding-left:30px;">} <span style="color:#0000ff;">else</span> {</p>
<p style="padding-left:60px;"><span style="color:#800080;">$where</span> = <span style="color:#0000ff;">array</span>(&#8216;<span style="color:#339966;">item_status !=</span>&#8216; =&gt; &#8216;<span style="color:#339966;">deleted</span>&#8216;, &#8216;<span style="color:#339966;">user_login</span>&#8216; =&gt; <span style="color:#800080;">$feed_user</span>, &#8216;<span style="color:#339966;">feed_status</span>&#8216; =&gt; &#8216;<span style="color:#339966;">active</span>&#8216;);</p>
<p style="padding-left:30px;">}<br />
<span style="color:#800080;">$items</span> = <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">db</span>-&gt;<span style="color:#800080;">limit</span>(<span style="color:#800080;">$limit</span>)<br />
-&gt;<span style="color:#800080;">offset</span>(<span style="color:#800080;">$offset</span>)<br />
-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">feeds</span>&#8216;, &#8216;<span style="color:#339966;">feeds.feed_id = items.item_feed_id</span>&#8216;, &#8216;<span style="color:#339966;">left outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">join</span>(&#8216;<span style="color:#339966;">users</span>&#8216;, &#8216;<span style="color:#339966;">users.ID = feeds.feed_user_id</span>&#8216;, &#8216;<span style="color:#339966;">left outer</span>&#8216;)<br />
-&gt;<span style="color:#800080;">order_by</span>(&#8216;<span style="color:#339966;">item_date</span>&#8216;, &#8216;<span style="color:#339966;">DESC</span>&#8216;)<br />
-&gt;<span style="color:#800080;">get_where</span>(&#8216;<span style="color:#339966;">items</span>&#8216;, <span style="color:#800080;">$where</span>)<br />
-&gt;<span style="color:#800080;">result</span>();</p>
<p style="padding-left:30px;"><span style="color:#0000ff;">return</span> <span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">_process</span>(<span style="color:#800080;">$items</span>);</p>
<p>}</p>
<p>You can download the source code for all the added and modified model <a href="http://www.brainstorm.pro/downloads/model.zip">here</a>.</p>
<p>Lastly, we needs to register the newly added <em>user_model</em> into SweetCron. In order to do that, we must add the code shown below into the file <span style="color:#ff0000;">&#8216;sweetcron/system/application/libraries/MY_Controller.php&#8217;</span></p>
<p style="padding-left:30px;"><span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">load</span>-&gt;<span style="color:#800080;">model</span>(&#8216;<span style="color:#339966;">user_model</span>&#8216;);</p>
<p>That’s all for now. Next time I will teach you how to modify the third element, which is the controller. If you want to view the final product of multiple user sweetcron go to <a href="http://www.brainstorm.pro/lifestream/" target="_blank">http://www.brainstorm.pro/lifestream/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=48&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2009/01/05/enable-multiple-user-feeds-in-sweetcron-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable Multiple User Feeds In SweetCron (Part 1)</title>
		<link>http://codegenius.wordpress.com/2009/01/02/multiple-user-sweetcron-part-1/</link>
		<comments>http://codegenius.wordpress.com/2009/01/02/multiple-user-sweetcron-part-1/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 18:15:23 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[multiple user sweetcron]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=25</guid>
		<description><![CDATA[As we know SweetCron a very useful application developed by Yong Fook that can automatically update our web server with our private status update feed such as facebook, flickr youtube, blog, twitter, digg, vimeo and much more. It is very useful for a personal use. But, what about a group of people who wanted to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=25&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As we know <strong><a title="sweetcron" href="http://www.sweetcron.com/" target="_blank">SweetCron</a></strong> a very useful application developed by <strong><a href="http://yongfook.com/">Yong Fook</a></strong> that can automatically update our web server with our private status update feed such as <strong>facebook</strong>, <strong>flickr</strong> <strong>youtube</strong>, <strong>blog</strong>, <strong>twitter</strong>, <strong>digg</strong>, <strong>vimeo</strong> and much more. It is very useful for a personal use. But, what about a group of people who wanted to know updates of each other in one web server? SweetCron currently does not provide such feature. So, the only way to make it possible, we have to extend the SweetCron feature ourselves.<span id="more-25"></span></p>
<p>In order to enable the multiple user feature in sweetcron, we must modify 4 elements in sweetcron which is database, model, view, and controller. In this post, I will only teach you how to modify the first elements which is the sweetcron&#8217;s database.</p>
<p><span style="text-decoration:underline;">Database</span></p>
<p>Firstly, we must add 2 more columns on the <em>users </em>table<em>.</em> One column to define the user type (admin or feed only) and another column to define the user avatar. Also, the <em>ID</em> column in <em>users</em> table needs to be renamed as <em>user_id</em> to avoid conflict with the <em>ID</em> column in <em>items </em>table when we join them.<em> </em>The altered <em>users</em> table should have all the column listed below.</p>
<p style="padding-left:30px;"><span style="text-decoration:underline;">users</span><br />
user_id &#8211; bigint(20)   //primary key (column name edited)<br />
user_login &#8211; varchar(60)<br />
user_pass &#8211; varchar(64)<br />
user_email &#8211; varchar(100)<br />
user_activation_key &#8211; varchar(60)<br />
user_type &#8211; varchar(20)  //added column<br />
user_avatar &#8211; varchar(50)  //added column</p>
<p>lastly, we must also create a relationship between the <em>feeds</em> table and <em>users</em> table. In order to do that, we must add one more column in the <em>feeds</em> table to store the foreign key of <em>users</em> table. The altered <em>feeds</em> table should have all the column listed below.</p>
<p style="padding-left:30px;"><span style="text-decoration:underline;">feeds</span><br />
feed_id &#8211; int(11)<br />
feed_title &#8211; text<br />
feed_icon &#8211; varchar(255)<br />
feed_url &#8211; text<br />
feed_data &#8211; longtext<br />
feed_status &#8211; varchar(20)<br />
feed_domain &#8211; varchar(255)<br />
feed_user_id &#8211; bigint(20)  //added column</p>
<p>That&#8217;s all for now. Next time I will teach you how to modify the second element, which is the model. If you want to view the final product of multiple user sweetcron go to <a href="http://www.brainstorm.pro/lifestream/" target="_blank">http://www.brainstorm.pro/lifestream/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=25&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2009/01/02/multiple-user-sweetcron-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding New Option In SweetCron</title>
		<link>http://codegenius.wordpress.com/2008/12/31/adding-new-option-in-sweetcron/</link>
		<comments>http://codegenius.wordpress.com/2008/12/31/adding-new-option-in-sweetcron/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 16:42:23 +0000</pubDate>
		<dc:creator>Otai</dc:creator>
				<category><![CDATA[SweetCron]]></category>
		<category><![CDATA[extending sweetcron]]></category>
		<category><![CDATA[sweetcron option]]></category>

		<guid isPermaLink="false">http://codegenius.wordpress.com/?p=7</guid>
		<description><![CDATA[Ok, before we start, we need to know that, sweetcron&#8217;s option is saved into the database in the table named &#8216;option&#8217;.  The table consists of 4 columns which is option_id, option_name, option_value, and autoload. In order to add new option, we need to add new item in the table. As an example, I wanted to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=7&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ok, before we start, we need to know that, sweetcron&#8217;s option is saved into the database in the table named &#8216;option&#8217;.  The table consists of 4 columns which is <em>option_id</em>, <em>option_name</em>, <em>option_value</em>, and <em>autoload</em>. In order to add new option, <span id="more-7"></span>we need to add new item in the table.</p>
<p>As an example, I wanted to add a new option to limit the no of latest blog post shown on the sweetcron page. So, I added a row with the following parameter:</p>
<ol>
<li>option_name=&#8217;latest_post_limit&#8217;</li>
<li>option_value=10</li>
<li>autoload=YES</li>
</ol>
<p>After added the row on the database, we also needs to add some code in sweetcron.</p>
<p>As we already know, sweetcron is an application that uses the CodeIgniter framework which uses the concept of Model-View-Controller (MVC). So, in order to modify the sweetcron source code, we need to modify the controller and view of the option inside the admin folder. We do not need to modify the option model because, we did not modify the option table structure.</p>
<p><span style="text-decoration:underline;">View</span></p>
<p>Location: <span style="color:#ff0000;">sweetcron/system/application/view</span><span style="color:#ff0000;">s/</span><span style="color:#ff0000;">admin/options.php</span><span style="text-decoration:underline;"><br />
</span></p>
<p>For the option view, we must add one more field inside the option&#8217;s form, where we want to input the option that we have added on the database. in my case, I added this code:</p>
<p style="padding-left:30px;">&lt;p&gt;<br />
&lt;label class=&#8221;title&#8221; for=&#8221;items_per_page_input&#8221;&gt;Latest Item Limit&lt;/label&gt;<br />
&lt;span class=&#8221;option_container&#8221;&gt;<br />
&lt;span class=&#8221;option&#8221;&gt;&lt;input id=&#8221;latest_post_limit_input&#8221; type=&#8221;text&#8221; name=&#8221;latest_post_limit&#8221; value=&#8221;&lt;?php echo $this-&gt;config-&gt;item(&#8216;latest_post_limit&#8217;)?&gt;&#8221; size=&#8221;5&#8243; /&gt;&lt;/span&gt;<br />
&lt;/span&gt;<br />
&lt;/p&gt;</p>
<p>make sure the name of the field is the same with the option_name value, in my case, &#8216;<em>latest_post_limit</em>&#8216;. Other than that, in order to make current option displayed when the option page is loaded, I also added a php line on the field&#8217;s value:</p>
<blockquote><p><span style="color:#0000ff;">echo </span><span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">config</span>-&gt;<span style="color:#800080;">item</span>(&#8216;<span style="color:#339966;">latest_post_limit</span>&#8216;)</p></blockquote>
<p>this line will  output the value of the specified <em>option_name</em>.</p>
<p><span style="text-decoration:underline;">Controller</span></p>
<p>Location: <span style="color:#ff0000;">sweetcron/system/application/controller</span><span style="color:#ff0000;">s/</span><span style="color:#ff0000;">admin/options.php</span><span style="text-decoration:underline;"><br />
</span></p>
<p>As For the Option Controller, we need to add a few more lines of code to make sure it will validate the input and save the option value into the database. In my case, I added the following code</p>
<p style="text-align:left;padding-left:30px;"><span style="color:#993300;"><span style="color:#0000ff;"> if</span> <span style="color:#000000;">(</span><span style="color:#993366;">$_POST</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span></span></p>
<p style="text-align:left;padding-left:60px;"><span style="color:#993300;"><span style="color:#000000;"><span style="color:#993366;">$this</span>-&gt;<span style="color:#993366;">load</span>-&gt;<span style="color:#993366;">library</span>(&#8216;<span style="color:#339966;">validation</span>&#8216;);</span><br />
<span style="color:#008000;"> //&#8230;&#8230;&#8230;&#8230;&#8230; other codes&#8230;&#8230;&#8230;&#8230;.</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#993366;"> $fields</span>['<span style="color:#339966;">latest_post_limit</span>] = &#8216;<span style="color:#339966;">Latest Post Limit</span>&#8216;;  <span style="color:#008000;">//added code</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;"><span style="color:#993366;"> $this</span>-&gt;<span style="color:#993366;">validation</span>-&gt;<span style="color:#993366;">set_</span><span style="color:#993366;">fields</span>(<span style="color:#993366;">$fields</span>);</span><br />
<span style="color:#008000;">//&#8230;&#8230;&#8230;&#8230;&#8230; </span><span style="color:#993300;"><span style="color:#008000;">other </span></span><span style="color:#993300;"><span style="color:#008000;"> codes&#8230;&#8230;&#8230;&#8230;.</span></span></p>
<p style="text-align:left;padding-left:60px;"><span style="color:#993300;"> <span style="color:#000000;"><span style="color:#800080;">$rules</span>['</span></span><span style="color:#993300;"><span style="color:#000000;"><span style="color:#339966;">latest_post_limit</span></span></span><span style="color:#993300;"><span style="color:#000000;">']    = &#8220;<span style="color:#339966;">numeric</span>&#8220;; </span></span><span style="color:#008000;">//added code</span></p>
<p style="text-align:left;padding-left:30px;">
<p style="text-align:left;"><span style="color:#008000;"><span style="color:#000000;">the key added for the array $fields and $rules must also be the same with the <em>option_name</em>. </span></span></p>
<p style="text-align:left;">After finished all the steps above, we have successfully added new option in Sweetcron. In order to acccess the newly created option, use the function</p>
<blockquote>
<p style="text-align:left;"><span style="color:#800080;">$this</span>-&gt;<span style="color:#800080;">config</span>-&gt;<span style="color:#800080;">item</span>(&#8216;<span style="color:#339966;">option_name</span>&#8216;)</p>
</blockquote>
<p style="text-align:left;">
<p style="text-align:left;">enjoy!!</p>
<p style="text-align:left;"><em><strong>Screenshot:</strong></em></p>
<p style="text-align:left;">
<div id="attachment_71" class="wp-caption alignnone" style="width: 480px"><img class="size-full wp-image-71" title="SweetCron With Latest Item Display Limit Option" src="http://codegenius.files.wordpress.com/2008/12/new_option.png?w=470&#038;h=437" alt="SweetCron With Latest Item Display Limit Option" width="470" height="437" /><p class="wp-caption-text">SweetCron With Latest Item Display Limit Option</p></div>
<p style="text-align:left;">
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codegenius.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codegenius.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codegenius.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codegenius.wordpress.com&amp;blog=5977336&amp;post=7&amp;subd=codegenius&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codegenius.wordpress.com/2008/12/31/adding-new-option-in-sweetcron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f95a527c17a81db6a483178bd88035bb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Otai</media:title>
		</media:content>

		<media:content url="http://codegenius.files.wordpress.com/2008/12/new_option.png" medium="image">
			<media:title type="html">SweetCron With Latest Item Display Limit Option</media:title>
		</media:content>
	</item>
	</channel>
</rss>
