<?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>cedmax.net &#187; php</title>
	<atom:link href="http://cedmax.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://cedmax.net</link>
	<description>my little journey through myself</description>
	<lastBuildDate>Wed, 18 Jan 2012 22:19:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress and Sweetcron integration</title>
		<link>http://cedmax.net/development/coding/wordpress-and-sweetcron-integration.html</link>
		<comments>http://cedmax.net/development/coding/wordpress-and-sweetcron-integration.html#comments</comments>
		<pubDate>Mon, 12 Jan 2009 19:31:22 +0000</pubDate>
		<dc:creator>cedmax</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sweetcron]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://cedmax.net/blog/?p=10</guid>
		<description><![CDATA[How to successfully <em>integrate sweetcron in wordpress</em> based websites using wp theme and dynamic data]]></description>
			<content:encoded><![CDATA[
<p>I was trying to integrate <strong><a href="http://cdmx.it/tQOCZG">wordpress</a></strong> and <strong><a href="http://cdmx.it/vSQEdU">sweetcron</a></strong> to have a “lifestream” section on my wordpress based website.</p>
<p>First of all I created a folder named <em>sweet</em> (you can use everything you like)<br>
then I tryed to integrate wordpress dynamic data (header, footer, sidebar and style) in sweetcron template.</p>
<p>that was pretty easy: I added this line of code:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p10code1'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p101"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p10code1"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;../wp-blog-header.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>on the top of index.php in sweetcron root</p>
<p>Now I was able to use every <a href="http://cdmx.it/t3IlU9">template tag</a> I needed (as well as widgets and everything else in use in wordpress) in sweetcron theme pages.. </p>
<p>The problem was that wordpress was returning a 404 error in http headers and page title was "Page not Found"</p>
<p>So i created a wordpress page named <em>Life Stream</em> with <em>sweet</em> as slug.</p>
<p>Sweetcron homepage was safe but every internal sweetcron link (for example <a href="/sweet/items/site/karma.cedmax.net">this</a>) had the same 404 problem.</p>
<p>so I wrote this really tiny plugin</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p10code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p102"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code" id="p10code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: Sweetcron integration
Plugin URI: http://cedmax.net
Version: 0.1
Description: Manage Sweetcron wordpress integration 
Author: cedmax
*/</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> sweetcheck<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$pagename</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'sweet'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$isStream</span> <span style="color: #339933;">=</span>  <a href="http://www.php.net/substr_count"><span style="color: #990000;">substr_count</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$pagename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$isStream</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pagename='</span><span style="color: #339933;">.</span><span style="color: #000088;">$pagename</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sweetcheck'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>change <em>sweet</em> with <em>yoursweetcroninstallationfolder</em> and everything should be fine.</p>
<p><strong>edit</strong> I had to remove my sweetcron installation: some problems with some of the feeds I was importing and no time to fix it, but the integration is still working</p>
]]></content:encoded>
			<wfw:commentRss>http://cedmax.net/development/coding/wordpress-and-sweetcron-integration.html/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

