<?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>Sitegrind</title>
	<atom:link href="http://www.sitegrind.nl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitegrind.nl</link>
	<description>Webdesign, or how to use html, css, php, MySQL, Javascript efficiëntly using frameworks such as WordPress, jQuery and Boilerplate.</description>
	<lastBuildDate>Fri, 04 Feb 2011 01:19:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Use Zend Framework in subfolder</title>
		<link>http://www.sitegrind.nl/zend-framework/use-in-subfolder/</link>
		<comments>http://www.sitegrind.nl/zend-framework/use-in-subfolder/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 19:14:41 +0000</pubDate>
		<dc:creator>Jeroen Franse</dc:creator>
				<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.sitegrind.nl/?p=40</guid>
		<description><![CDATA[What do you need to do? Nothing! Put it in a subfolder. Trying to find the awnser on the question: &#8220;How do you use Zend Framework in a subfolder&#8221; a lot of resources I found referred to an article on Alexander Netkachev&#8217;s blog. At the time of writing Alex is reviewing all of his articles, [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>What do you need to do? Nothing! Put it in a subfolder.</p></blockquote>
<p>Trying to find the awnser on the question: &#8220;How do you use Zend  Framework in a subfolder&#8221; a lot of resources I found referred to <a title="zend controller in subfolder" href="http://www.alexatnet.com/Blog/Index/2006-09-26/using-zend_controller-in-subfolder" target="_blank">an article on Alexander Netkachev&#8217;s blog</a>.  At the time of writing Alex is reviewing all of his articles, so I had  to figure this out one myself. Hopefully Alex&#8217;s article will be online  anytime soon. I&#8217;m sure it contains valuable information. However, I  guess it is not the information I was looking for. On <a title="zend about solution zend in subfolder" href="http://devzone.zend.com/article/971" target="_blank">Zend Devzone </a>Carl  Evans refers to Alex&#8217;s article and the 2 solutions found by Alex. He  quotes the opening paragraph, revieling some information about 2  provided solutions in the last few lines:</p>
<blockquote><p>First is rather a hack then a recommended solution, but  with it you can  start the applications and examples that use standard  router. The second  is neater but it depends on the  Zend_Controller_RewriteRouter class.</p></blockquote>
<p>A hack? Depends on the router? Not sure we are adressing the same  problem here. Maybe his solution is for people having no access to the  directory above the public directory. I don&#8217;t know. My solution is almost to easy. It only needs minor editing of index.php. Off course there is are some caveats.</p>
<p>Firstly I will make clear what we are talking about here. What is the folder structure we are creating? Next I  will show you how to put your Zend Framework in a subfolder. Be  sure to also read the conditions to be met when using this solution. As  you might expect, these are mainly about links to pages and resources  inside your own domain. The <strong>Zend View Helpers BaseUrl </strong>and <strong>Url </strong>are key to our  solution.<span id="more-40"></span></p>
<h3>Sub folder structure for your Zend Framwork project:</h3>
<p>To be clear, this is the directory structure I&#8217;m looking for:</p>
<pre>application/
library/
<span style="color: #ff6600;">project1</span>/
    application/
    library/
<span style="color: #ff6600;">secondproject</span>/
    application/
    library/
<span style="color: #ff6600;">otherproject</span>/
    application/
    library
<span style="color: #008000;">public</span>/
    css/
    imgages/
    js/
    .htaccess
    index.php
    <span style="color: #ff6600;">project1</span>/
        css/
        imgages/
        js/
        .htaccess
        index.php
    <span style="color: #ff6600;">secondproject</span>/
        css/
        imgages/
        js/
        .htaccess
        index.php
    <span style="color: #ff6600;">otherproject</span>/
        css/
        imgages/
        js/
        .htaccess
        index.php</pre>
<p>Each project&#8217;s application, library, etc. (see <a title="zend framework recommended folder structure" href="http://framework.zend.com/manual/en/project-structure.project.html" target="_blank">Zend Framework recommended file structure</a>) in it&#8217;s own project folder. One directory up from the public directory (as recommended).</p>
<p>Inside the public directory each project has it&#8217;s own folder containing <em>index.php </em>&amp; <em>.htaccess</em> files and <em>css </em>, <em>js </em>etc. folders.</p>
<h3>The solution</h3>
<p>Put your files like the structure above. For each project, open the index.php file and adjust the <em>APPLICATION_PATH</em> and <em>php_include_path</em>. For project1:</p>
<pre>'/../application'</pre>
<p>now becomes</p>
<pre>'/../../project1/application/'</pre>
<p>Same goes for php_include_pahts. All projects can live on one set of Zend_ files. Change paths accordingly. Many tutorials will tell you to set the baseUrl. You don&#8217;t set it (you can off course), you use it. Done, simple enough?</p>
<p>The first cotcha I ran into is my .htaccess file in the main public folder was setting the APPLICATION_ENV. Be aware of this.</p>
<h3>Use of the Zend View Helpers BaseUrl and Url</h3>
<p>The second thing to check are urls for navigation to other pages on the website. They all have to start with &#8216;/project1&#8242; (if you look at pages inside project1 folder). This means that if you want to use your projects in sub-folders, you have to use either the Zend_View_Helper_BaseUrl or the Zend_View_Helper_Url to create your internal referring urls. See documentation for proper use of there helpers. One example:</p>
<p>before you would have:</p>
<pre>/users/peter/id/3</pre>
<p>you will now either use:</p>
<pre>$this-&gt;baseUrl('users/peter/id/3')</pre>
<p>or:</p>
<pre>$this-&gt;url(array('id'=&gt;'3'),'default')</pre>
<h3>Zend Navigation</h3>
<p>When using Zend_Navigation for creating menu&#8217;s etc, you have to define all modules, controllers, actions, routes etc. Yes, I know.. This solution is only for people going &#8216;all the way&#8217; with the Zend_Navigation. You can&#8217;t use Zend_Navigation with uri based navigation descriptions. You don&#8217;t have to use Zend_Navigation, the options stated above work as well.</p>
<h3>Css files, image paths relative</h3>
<p>Don&#8217;t forget to use the baseUrl helper on you css file paths, same applies for javaScript files.</p>
<pre>$this-&gt;headLink()-&gt;appendStylesheet($this-&gt;view-&gt;baseUrl('css/style.css'));</pre>
<p>What about the background images used in css? Write your image urls relative (without starting &#8216;/&#8217;  ) to the path of the css file referring to them. This means location of css file and  its images are bound to each other, relatively. Put css in your css folder, background images in a css/img folder. You&#8217;ll be fine.</p>
<h3>Summary how to put Zend Framework in a subfolder</h3>
<ul>
<li>Give project&#8217;s resources (application, library) a folder in the sub directory  from public directory</li>
<li>Create a subfolder for public files, index.php, .htaccess, css-files etc.</li>
<li>Change APPLICATION_PATH in index.php</li>
<li>Change php_include_paths in index.php</li>
</ul>
<p>Check the following:</p>
<ul>
<li>Zend_Navigation must use MVC pages</li>
<li>Urls are created with
<ul>
<li>View helper: url</li>
<li>View helper: baseUrl</li>
</ul>
</li>
<li>Don&#8217;t forget css and javaScript files</li>
<li>background-images have relative path</li>
</ul>
<p>Did this help? Are you stuck? Do you need an other folder structure? What other things did you run in to applying this method? Let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitegrind.nl/zend-framework/use-in-subfolder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code for jQuery read from other domains</title>
		<link>http://www.sitegrind.nl/jquery/code-for-jquery-read-from-other-domains/</link>
		<comments>http://www.sitegrind.nl/jquery/code-for-jquery-read-from-other-domains/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 23:49:59 +0000</pubDate>
		<dc:creator>Jeroen Franse</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.sitegrind.nl/?p=27</guid>
		<description><![CDATA[The code is in this quick tutorial about how to read content from websites on other domains and publish it on your own html site. All done using jQuery and a small php script you can copy. It belongs to the original article, where you can find more info. Don&#8217;t need that, just look at [...]]]></description>
			<content:encoded><![CDATA[<p class="klein">The code is in this quick tutorial about how to <strong>read </strong>content from <strong>websites on other domains</strong> and publish it on your own html site. All done using <strong>jQuery </strong>and a small php script you can copy. It belongs to the <a title="jquery original article" href="http://www.sitegrind.nl/jquery/jquery-load-function-get-content-from-other-websites/">original article</a>, where you can find more info. Don&#8217;t need that, just look at the <strong><a title="Febo snacks met jQuery load" href="http://www.sitegrind.nl/examples/febo/">demo</a></strong> and use these files!</p>
<h2 class="klein">HTML file to read websites</h2>
<p>Take this html.</p>
<p><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;<br />
&lt;html&gt;&lt;head&gt;<br />
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;<br />
&lt;script&gt;<br />
$(document).ready(function(){<br />
$("#allh2").load(</code><code>"http://www.yourdomain.com/loader.php h2"</code><code>,{want2Read:'http://www.want2read.com/'},function(){<br />
//Write your additional jQuery script below. For instance:<br />
$("h2").attr("class","coolheader");<br />
});<br />
});<br />
&lt;/script&gt; &lt;/head&gt; &lt;body&gt;<br />
&lt;h1&gt;Wow, this stuff is need&lt;/h1&gt;<br />
&lt;p class="optionalcontent"&gt;All headers from &lt;a href="http://www.want2read.com/"&gt;want2read&lt;/a&gt;, I learned this from &lt;a href="http://www.sitegrind.nl/"&gt;Sitegrind&lt;/a&gt;&lt;/p&gt;<br />
&lt;div id="allh2"&gt; &lt;/div&gt;<br />
&lt;/body&gt; &lt;/html&gt;</code></p>
<p>In this html file, you <strong>must </strong>change 2 things:</p>
<ol>
<li>change &#8216;<code>yourdomain</code>&#8216;, in the script you see in the header, in -duh- your domain name</li>
<li>change &#8216;<code>http://www.want2read.com/'</code>in the domain you want to loan content from</li>
</ol>
<p>This is what you <strong>leave alone</strong>:</p>
<ul>
<li><code>want2Read</code>, the first one in (<code>want2Read:'http://www.want2Read.com/'</code>)
<ul>
<li>fyi: this is the name of a variable php is going to use</li>
</ul>
</li>
<li>The <code>$("#allh2")</code> and <code>&lt;div id="allh2"&gt; &lt;/div&gt; ,<br />
</code></p>
<ul>
<li>if you change, keep them complying with each other</li>
</ul>
</li>
</ul>
<p>What you <strong>can change</strong>. Save this for later, make files working first. Nevertheless, be inspired!:</p>
<ul>
<li>Feel free to write you own test in the html file. Don&#8217;t forget to be gentle. Always put a reference to site you borrowed the content from.</li>
<li>the h2 after yourdomain (<code>"http://www.yourdomain.com/loader.php <span style="text-decoration: underline;">h2</span>"</code> )
<ul>
<li>examples: h1, div#goodstuff, a[href*='domainname'], img.realones</li>
</ul>
</li>
</ul>
<p>This is where the good stuff happens! Although not clearly recognizable because of omitting $ sign, this is where you can use our so beloved <strong>jQuery selectors! </strong>I haven&#8217;t tested in how far the chain ability of jQuery applies to this special use of selector and its unusual semantics. Let me know if you tested. I like to use this as a first selection. And than use the callback function to perform further action.</p>
<p>save this file as index.html on your server.</p>
<h2 class="klein">The php to help jQuery load the website</h2>
<p>Copy and paste this php in a text file and save on your server as loader.php, in the same directory as the index.html. Change nothing.</p>
<p><code>&lt;?php<br />
extract($_POST);<br />
$str = file_get_contents($want2Read);<br />
echo $str;<br />
?&gt;</code></p>
<p>Many of sites protect their content, if this doesn&#8217;t work you can use the alternate php code. See the <a title="Html and jQuery" href="http://www.sitegrind.nl/jquery/jquery-load-function-get-content-from-other-websites/">original article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitegrind.nl/jquery/code-for-jquery-read-from-other-domains/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>jQuery load function, get content from other websites</title>
		<link>http://www.sitegrind.nl/jquery/jquery-load-function-get-content-from-other-websites/</link>
		<comments>http://www.sitegrind.nl/jquery/jquery-load-function-get-content-from-other-websites/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 20:43:39 +0000</pubDate>
		<dc:creator>Jeroen Franse</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://sitegrind.nl/?p=14</guid>
		<description><![CDATA[This is about using the load function from jQuery. How to use it across domains to load content from other sites and show it on your own. Yes, it can. But, not alone (at least, not for me). I managed to get it working with php. And no, you don&#8217;t have to understand php read [...]]]></description>
			<content:encoded><![CDATA[<p>This is about using the <a title="jQuery load" href="http://docs.jquery.com/Ajax/load#urldatacallback"><strong>load</strong> </a>function from <a title="jquery" href="http://jquery.com/"><strong>jQuery</strong></a>. How to use it <strong>across domains </strong>to load content from other sites and show it on your own. Yes, it can. But, not alone (at least, not for me). I managed to get it working <strong>with php</strong>. And no, you don&#8217;t have to understand php read on and amaze yourself.</p>
<ul>
<li>Must know:
<ul>
<li>How to put a html website online.</li>
<li>Copy and paste. That sounds cheap and it is. Nevertheless this code can be of great value to you</li>
</ul>
</li>
<li>Must not know:
<ul>
<li>For this tutorial you don&#8217;t have to know javaScript (I don&#8217;t)</li>
<li>php</li>
<li>jQuery. Nevertheless, people using <strong>jQuery </strong>will have a special interest in this article!</li>
</ul>
</li>
</ul>
<p>Like quick and dirty? Leave this tutorial with all its explanations. Have a look at the cool <strong><a title="Example demo jQuery load" href="http://www.sitegrind.nl/examples/febo/index.html">demo</a></strong> first, wow, loading all images from a complete other website! Than copy the complete, small <strong><a title="php and html with jquery" href="http://www.sitegrind.nl/jquery/code-for-jquery-read-from-other-domains/">html and php scripts</a></strong>. Thunderbirds are go!</p>
<h2 class="klein">Php reads html file</h2>
<p>Php can do what you came here for in the fist place: <strong>load content</strong>, e.g. <strong>images</strong> from other web pages and show it on your own website. The file_get_contents function reads html code. The  <strong>php</strong> code you are going to use looks like this:</p>
<p><code>extract($_POST);<br />
$str = file_get_contents($site2Read);<br />
echo $str;</code></p>
<p>You don&#8217;t have to understand that. This is what you do. Copy this code <strong>literally</strong>, do not replace anything.   As I said before, copy in a .txt file and save as loader.php , in the same directory as your html file.</p>
<p>PS: for some domains this piece of php will not work. These are protective restrictions. Webmasters try to prevent your script to read their content like this.  Try this <strong>alternate code </strong>instead. Works more often. It still is copy paste, just as much work as the code above. Copy in tekstfile (notepad) and save as loader.php  :<br />
<code><br />
extract($_POST);<br />
$page= get_url_contents($site2Read);<br />
echo $page;<br />
function get_url_contents($url){<br />
$crl = curl_init();<br />
$timeout = 5;<br />
curl_setopt ($crl, CURLOPT_URL,$url);<br />
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);<br />
$ret = curl_exec($crl);<br />
curl_close($crl);<br />
return $ret;<br />
}<br />
</code></p>
<p>Many thanks to <a title="How To Geek" href="http://www.howtogeek.com/">the How-To Geek</a> for this.</p>
<h2 class="klein">Load function from jQuery for images only</h2>
<p>So far for the php part. The reason I want to do this with <em>jQuery </em>in the first place is because of its sweet <strong>filtering functions</strong>. You can start filtering content in the jQuery load function already! This means you can pick, for instance, all <strong>images</strong> / <strong>pictures </strong>from a site. And show them directly on your site, next to your other content. Or all links from an an other site, or all headers (h1, h2). Or all divisions containing the word &#8216;hello&#8217;. Or all unsorted lists (<code>&lt;ul&gt;</code>) having an id-attribute with text &#8216;favorites&#8217; in it. And so on, get the idea? You know some jQuery, right? Here, as an example, we are going to get all header 2 elements  from a website, the &lt;h2&gt; part. My original tutorial loaded all images from a html site. But images are often well protected. To make things working fast we are going to use h2. This is the proper <strong>load </strong>function:</p>
<p><code>$("#allh2").load("http://www.yourdomain.com/loader.php h2",{want2Read:"http://www.want2Read.com/"});</code></p>
<ul>
<li>Replace <code>http://www.yourdomain.com/loader.php </code>with -duh-&#8230;</li>
<li>Replace http://www.want2Read.com/ with the website you want to read.</li>
<li>Make sure there is a division with id=&#8221;allh2&#8243; on your html-page. Thus:<code>&lt;div id="allh2"&gt;&lt;/div&gt;</code></li>
</ul>
<h2 class="klein">Use jQuery after the content loaded</h2>
<p>This is some additional info. If you want to perform more <strong>jQuery </strong>actions on the <strong>loaded content</strong>, you can use the <em>callback </em>from the load function. What does this means? It means that you write you jQuery like this:</p>
<p><code>$("#allh2").load("http://www.yourdomain.com/loader.php h2",{want2Read:"http://www.want2Read.com/"},function(){<br />
//Write your additional jQuery script here, for instance:<br />
</code><code>$("h2").css("background-color","#ff0");</code><br />
<code> });</code></p>
<p>As you see, you can now access the h2 elements with jQuery. If you would have written it after the load function, instead of using it in the callback, it would have had no effect on the loaded images. All words. Just copy paste and let the fun begin! Copy extra easy from the article with <strong><a title="jQuery script php read load" href="http://www.sitegrind.nl/jquery/code-for-jquery-read-from-other-domains/">complete html and php script</a></strong> listings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitegrind.nl/jquery/jquery-load-function-get-content-from-other-websites/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>First post</title>
		<link>http://www.sitegrind.nl/uncategorized/hello-world/</link>
		<comments>http://www.sitegrind.nl/uncategorized/hello-world/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 16:48:14 +0000</pubDate>
		<dc:creator>Jeroen Franse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sitegrind.nl/?p=1</guid>
		<description><![CDATA[Here I am. First post. I just filled in something about my in author. Posts will follow. The first one will be about clearing floats (CSS).]]></description>
			<content:encoded><![CDATA[<p>Here I am. First post. I just filled in something about my in author. Posts will follow. The first one will be about clearing floats (CSS).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sitegrind.nl/uncategorized/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

