<?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>Web Development Blog &#187; framework</title>
	<atom:link href="http://www.web-development-blog.com/archives/tag/framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.web-development-blog.com</link>
	<description>Web development tutorials, SEO articles and PHP script resources</description>
	<lastBuildDate>Sun, 25 Jul 2010 14:38: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>First steps within the Zend Framework</title>
		<link>http://www.web-development-blog.com/archives/first-steps-within-the-zend-framework/</link>
		<comments>http://www.web-development-blog.com/archives/first-steps-within-the-zend-framework/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 16:32:55 +0000</pubDate>
		<dc:creator>Olaf</dc:creator>
				<category><![CDATA[PHP scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.web-development-blog.com/archives/first-steps-within-the-zend-framework/</guid>
		<description><![CDATA[Setup a quick Yahoo Search page within a few minutes! A few days ago the &#8220;old&#8221; Google web search API has stopped working for the web public. Not a big surprise after the release of the AJAX web search API. A customer of mine is using search results in his mini sites to give them [...]]]></description>
			<content:encoded><![CDATA[<!--S-ButtonZ 1.1.5 Start--><!--S-ButtonZ 1.1.5 End--><h3>Setup a quick Yahoo Search page within a few minutes!</h3>
<p>A few days ago the &#8220;old&#8221; Google web search API has stopped working for the web public. Not a big surprise after the release of the AJAX web search API. A customer of mine is using search results in his mini sites to give them a little more body. This is why I needed to look for some alternative. During the Zend PHP conference earlier this year, I got in touch with the Zend framework and learned that there is already a class to obtain results from the Yahoo search engine. The class has features to search the Yahoo API for web sites, image, news and the local search results.</p>
<h3>Installing the library</h3>
<p>I decided some time before to use the classes from the <a href="http://framework.zend.com/home" rel="nofollow">Zend framework</a> for future projects because the classes are well written in PHP5. If you like to do the same you should install the lib on a central place on your web server to get access to the framework from all your  websites. After uploading the files I added this row to .htaccess file for the website I&#8217;m working on:</p>
<p><code>php_value include_path ".:/home/mylocation_for_zend_framework/"</code></p>
<p>This way you&#8217;re able to access the classes without to think about the class paths. Of course you are free to add this include path to the php.ini file or to your apache configuration.<span id="more-122"></span></p>
<h3>Search Yahoo via the API</h3>
<p>Before you can start you need to request a Yahoo developer key. Visit this <a href="https://developer.yahoo.com/wsregapp/index.php" rel="nofollow">page</a> and get one for free.</p>
<p>The <a href="http://framework.zend.com/manual/en/zend.service.yahoo.html#zend.service.yahoo.websearch" rel="nofollow">manual</a> for the  Zend framework has easy to use examples for all important methods. This way you&#8217;re able to have a result without to think about the code. Just create a file and add this code and add the Yahoo developer key:</p>
<p><code>require_once 'Zend/Service/Yahoo.php';<br />
$yahoo = new Zend_Service_Yahoo("YAHOO_APPLICATION_ID");<br />
$results = $yahoo-&gt;webSearch('PHP');<br />
foreach ($results as $result) {<br />
echo $result-&gt;Title;<br />
}</code></p>
<p>Run this script and you get the titles for the top10 results for a Yahoo search on &#8220;PHP&#8221;. Just enter a different search keyword (or variable) to get different results. According the <a href="http://developer.yahoo.com/search/web/V1/webSearch.html" rel="nofollow">Yahoo web search documentation</a> we have some important search features like:</p>
<ul>
<li>region (Yahoo has different local search engines for countries like UK, NL or DE)</li>
<li>results (the number of results you get back for your query: default 10, max. 100)</li>
<li>start (you need this one to get result pages like with a real search engine)</li>
<li>language (if you need other results than in English language)</li>
</ul>
<p>There are more options check their site for more further reference. In our example we want to have control about the options above. To use them we need to add the keys and values into an array:</p>
<p><code>$options = array('start' =&gt; 10, 'language' =&gt; 'nl', 'results'  =&gt; 10, 'region' =&gt; 'nl');</code></p>
<p>This option array can be used in the &#8220;webSearch()&#8221; method this way:</p>
<p><code>$results = $yahoo-&gt;webSearch('PHP scripts', $options);</code></p>
<p>While executing this modified snippet we get some error because the option &#8220;region&#8221; is not included in the class. Not so bad, but it&#8217;s very important to have this option because the US version doesn&#8217;t have so much Dutch language results. After checking the class (file: Zend/Service/Yahoo.php)  I found this code on row 529:</p>
<p><code>$validOptions = array('appid', 'query', 'results', 'start', 'language', 'type', 'format', 'adult_ok',<br />
'similar_ok', 'country', 'site', 'subscription', 'license');</code></p>
<p>Just add the value &#8220;region&#8221; to this array and you&#8217;re fine (I will submit this change to Zend and I&#8217;m sure they will add this change to future releases).</p>
<p>If you combine this snipped with a form you have almost a full featured search box for your website. To create a complete result with summary and URL we need this code snippet (replace this code with the prev. &#8220;output&#8221; code):</p>
<p><code>echo '&lt;p&gt;&lt;a href="'.$result-&gt;Url.'"&gt;'.$result-&gt;Title.'&lt;/a&gt;&lt;br /&gt;<br />
'.$result-&gt;Summary.'&lt;/p&gt;';</code></p>
<p>Thats all, only some small snippet and you have some fast Yahoo search results for your website.<strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.web-development-blog.com/archives/php-mail-scripts-using-smtp-transport-a-guide-for-beginners/" rel="bookmark" title="April 12, 2010">PHP Mail Scripts using SMTP transport, a guide for beginners</a></li>
<li><a href="http://www.web-development-blog.com/archives/search-for-photos-using-php-and-the-flickr-api/" rel="bookmark" title="December 19, 2009">Search for photos using PHP and the flickr API</a></li>
<li><a href="http://www.web-development-blog.com/archives/create-pdf-documents-online-with-tcpdf/" rel="bookmark" title="May 27, 2010">Create PDF documents Online with TCPDF</a></li>
</ul>
<p><!-- Similar Posts took 3.176 ms --></p>
<div style="clear:both;">&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.web-development-blog.com/archives/first-steps-within-the-zend-framework/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->