<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/2.4.6" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>WebDnes</title>
		<link>http://www.webdnes.cz/blog/blog2.php</link>
		<description></description>
		<language>en-US</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=2.4.6"/>
		<ttl>60</ttl>
				<item>
			<title>Smarty resources - template from string</title>
			<link>http://www.webdnes.cz/blog/blog2.php/2009/12/23/smarty-resources-template-from-string</link>
			<pubDate>Wed, 23 Dec 2009 10:16:51 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">4@http://www.webdnes.cz/blog/</guid>
						<description>&lt;p&gt;Smarty templates are usually stored in a template file, but in certain cases this may not be desirable. Another possibility for storing the templates is database and the documentation contains nice &lt;a href=&quot;http://www.smarty.net/manual/en/template.resources.phphttp://www.smarty.net/manual/en/template.resources.php&quot;&gt;example &lt;/a&gt;. But, in a structured Php code, the code directly interacting with the database will be in another layer than the code using the template for displaing the results. Moreover, the template from the database should be loaded together with other related data, to make the database query more efficient. Bellow is an example of a display-layer class that uses templates already fetched from the database and together with other data stored in a data-layer classes. I was to some extend inspired by this &lt;a href=&quot;http://blog.felho.hu/how-to-use-smarty-resources.html&quot;&gt;smarty-related&lt;/a&gt; post. I apologise for possible errors, the example is derived from a working real code, but it is a simplified and not tested version.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br /&gt;
&lt;?php  &lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
*  Display class outputs all categories starting at certain node&lt;br /&gt;
* &lt;br /&gt;
* @uses  Categories_Data_Categories&lt;br /&gt;
* @package  Categories&lt;br /&gt;
* @subpackage  Views&lt;br /&gt;
* @copyright WebDnes.cz&lt;br /&gt;
* @author Vaclav Mach&lt;br /&gt;
*/&lt;br /&gt;
  class Categories_Views_List  {&lt;br /&gt;
      private $DataCategories;&lt;br /&gt;
      private $smarty;&lt;br /&gt;
      private static $mktime;&lt;br /&gt;
      private static $template;&lt;br /&gt;
  &lt;br /&gt;
      &lt;br /&gt;
      /**&lt;br /&gt;
      * @param mixed $smarty  ... an instance of Smarty object&lt;br /&gt;
      */&lt;br /&gt;
      public function __construct($tree, $id_parent=0, $smarty) {&lt;br /&gt;
          $this-&gt;DataCategories=new Categories_Data_Categories($tree, $id_parent);&lt;br /&gt;
          $this-&gt;smarty=$smarty;&lt;br /&gt;
                /**&lt;br /&gt;
                 *  here we register static function of this display class as the smarty resources&lt;br /&gt;
                 *  note that the functions are public to be accesible for smarty                 &lt;br /&gt;
                 */                                &lt;br /&gt;
                 $smarty-&gt;register_resource(&quot;text&quot;, array(&quot;Categories_Views_List::text_get_template&quot;,&lt;br /&gt;
                                           &quot;Categories_Views_List::text_get_timestamp&quot;,&lt;br /&gt;
                                           &quot;Categories_Views_List::text_get_secure&quot;,&lt;br /&gt;
                                           &quot;Categories_Views_List::text_get_trusted&quot;));&lt;br /&gt;
                $this-&gt;template_article=$this-&gt;get_template_article($tree);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
    *  iterates the collection of data classes &lt;br /&gt;
    *  and sends them one by one to the display function&lt;br /&gt;
    */&lt;br /&gt;
    public function DisplayAll() {&lt;br /&gt;
        $ret=&quot;&quot;;&lt;br /&gt;
         while ($DataCategory = $this-&gt;DataCategories-&gt;GetCategoryClass()) {&lt;br /&gt;
           $ret.=  $this-&gt;DisplayCategory($DataCategory);&lt;br /&gt;
         }&lt;br /&gt;
         return $ret;&lt;br /&gt;
    }&lt;br /&gt;
   &lt;br /&gt;
   /**&lt;br /&gt;
   * this is the actual diplay function, important for this example&lt;br /&gt;
   *  &lt;br /&gt;
   * @param Categories_Data_Category $DataCategory  is a data class containing all the necessary data&lt;br /&gt;
   * template, templatemodification time, and textual data e.g. category title and description are stored in the same table &lt;br /&gt;
   */&lt;br /&gt;
    private function   DisplayCategory(Categories_Data_Category $DataCategory) {&lt;br /&gt;
&lt;br /&gt;
         /**&lt;br /&gt;
         *   every piece of data, this means every data class may contain its own template  &lt;br /&gt;
         *   the template is assigned to static  variable to &lt;br /&gt;
         *   make it accessible for the registered  resource functions   &lt;br /&gt;
         */&lt;br /&gt;
         self::$template=$DataCategory-&gt;Gettemplate(); &lt;br /&gt;
         self::$mktime=$DataCategory-&gt;GetLastModifiedTime();  &lt;br /&gt;
        &lt;br /&gt;
         // and this is the textual data for the template&lt;br /&gt;
         $title=$DataCategory-&gt;GetTitle();&lt;br /&gt;
         $description=$DataCategory-&gt;GetDescription();&lt;br /&gt;
         $this-&gt;smarty-&gt;assign(&quot;cat_title&quot;, $DataCategory-&gt;GetTitle()); &lt;br /&gt;
         $this-&gt;smarty-&gt;assign(&quot;cat_description&quot;, $DataCategory-&gt;GetDescription());&lt;br /&gt;
          &lt;br /&gt;
         // or shorter way&lt;br /&gt;
         $this-&gt;smarty-&gt;assign(&quot;cat_img&quot;, $DataCategory-&gt;GetImage()); &lt;br /&gt;
        &lt;br /&gt;
         /**&lt;br /&gt;
         * the name of the template is unique for each data class&lt;br /&gt;
         * i do know smarty enough to be sure this is necessary for e.g. catching &lt;br /&gt;
         * appending .tpl is just custom &lt;br /&gt;
         */&lt;br /&gt;
         $templatename=&quot;cat&quot;.$DataCategory-&gt;GetId().&quot;.tpl&quot;; &lt;br /&gt;
         &lt;br /&gt;
         /**&lt;br /&gt;
         *  in this call, smarty uses the static resources functions bellow and assigns  &lt;br /&gt;
         *  variables to the template&lt;br /&gt;
         *  note that the template was specified  just few lines above and is therefore specofic&lt;br /&gt;
         *  for the data in every data class in  the DataCategories collection&lt;br /&gt;
         */&lt;br /&gt;
        &lt;br /&gt;
         $ret= $this-&gt;smarty-&gt;fetch(&quot;text:$templatename&quot;);  &lt;br /&gt;
     &lt;br /&gt;
         return $ret;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
 public static function text_get_template($tpl_name, &amp;amp;$tpl_source, &amp;amp;$smarty)&lt;br /&gt;
{&lt;br /&gt;
/**&lt;br /&gt;
*   uses the static variable assigned in the DisplayCategory function  &lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
if(!empty(self::$template)) {&lt;br /&gt;
            $tpl_source=self::$template;&lt;br /&gt;
            return true;&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
        return false;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
 public static function text_get_timestamp($tpl_name, &amp;amp;$tpl_timestamp, &amp;amp;$smarty)&lt;br /&gt;
{&lt;br /&gt;
/**&lt;br /&gt;
*  uses the static variable assigned in the DisplayCategory function &lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
if(!empty(self::$mktime)) {&lt;br /&gt;
            $tpl_timestamp=self::$mktime;&lt;br /&gt;
            return true;&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
        return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 public static function text_get_secure($tpl_name, &amp;amp;$smarty)&lt;br /&gt;
{&lt;br /&gt;
    // assume all templates are secure&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 public static function text_get_trusted($tpl_name, &amp;amp;$smarty)&lt;br /&gt;
{&lt;br /&gt;
    // not used for templates&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
  }&lt;br /&gt;
?&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.webdnes.cz/blog/blog2.php/2009/12/23/smarty-resources-template-from-string&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Smarty templates are usually stored in a template file, but in certain cases this may not be desirable. Another possibility for storing the templates is database and the documentation contains nice <a href="http://www.smarty.net/manual/en/template.resources.phphttp://www.smarty.net/manual/en/template.resources.php">example </a>. But, in a structured Php code, the code directly interacting with the database will be in another layer than the code using the template for displaing the results. Moreover, the template from the database should be loaded together with other related data, to make the database query more efficient. Bellow is an example of a display-layer class that uses templates already fetched from the database and together with other data stored in a data-layer classes. I was to some extend inspired by this <a href="http://blog.felho.hu/how-to-use-smarty-resources.html">smarty-related</a> post. I apologise for possible errors, the example is derived from a working real code, but it is a simplified and not tested version.</p>

<p><code><br />
<?php  <br />
<br />
/**<br />
*  Display class outputs all categories starting at certain node<br />
* <br />
* @uses  Categories_Data_Categories<br />
* @package  Categories<br />
* @subpackage  Views<br />
* @copyright WebDnes.cz<br />
* @author Vaclav Mach<br />
*/<br />
  class Categories_Views_List  {<br />
      private $DataCategories;<br />
      private $smarty;<br />
      private static $mktime;<br />
      private static $template;<br />
  <br />
      <br />
      /**<br />
      * @param mixed $smarty  ... an instance of Smarty object<br />
      */<br />
      public function __construct($tree, $id_parent=0, $smarty) {<br />
          $this->DataCategories=new Categories_Data_Categories($tree, $id_parent);<br />
          $this->smarty=$smarty;<br />
                /**<br />
                 *  here we register static function of this display class as the smarty resources<br />
                 *  note that the functions are public to be accesible for smarty                 <br />
                 */                                <br />
                 $smarty->register_resource("text", array("Categories_Views_List::text_get_template",<br />
                                           "Categories_Views_List::text_get_timestamp",<br />
                                           "Categories_Views_List::text_get_secure",<br />
                                           "Categories_Views_List::text_get_trusted"));<br />
                $this->template_article=$this->get_template_article($tree);<br />
    }<br />
<br />
    /**<br />
    *  iterates the collection of data classes <br />
    *  and sends them one by one to the display function<br />
    */<br />
    public function DisplayAll() {<br />
        $ret="";<br />
         while ($DataCategory = $this->DataCategories->GetCategoryClass()) {<br />
           $ret.=  $this->DisplayCategory($DataCategory);<br />
         }<br />
         return $ret;<br />
    }<br />
   <br />
   /**<br />
   * this is the actual diplay function, important for this example<br />
   *  <br />
   * @param Categories_Data_Category $DataCategory  is a data class containing all the necessary data<br />
   * template, templatemodification time, and textual data e.g. category title and description are stored in the same table <br />
   */<br />
    private function   DisplayCategory(Categories_Data_Category $DataCategory) {<br />
<br />
         /**<br />
         *   every piece of data, this means every data class may contain its own template  <br />
         *   the template is assigned to static  variable to <br />
         *   make it accessible for the registered  resource functions   <br />
         */<br />
         self::$template=$DataCategory->Gettemplate(); <br />
         self::$mktime=$DataCategory->GetLastModifiedTime();  <br />
        <br />
         // and this is the textual data for the template<br />
         $title=$DataCategory->GetTitle();<br />
         $description=$DataCategory->GetDescription();<br />
         $this->smarty->assign("cat_title", $DataCategory->GetTitle()); <br />
         $this->smarty->assign("cat_description", $DataCategory->GetDescription());<br />
          <br />
         // or shorter way<br />
         $this->smarty->assign("cat_img", $DataCategory->GetImage()); <br />
        <br />
         /**<br />
         * the name of the template is unique for each data class<br />
         * i do know smarty enough to be sure this is necessary for e.g. catching <br />
         * appending .tpl is just custom <br />
         */<br />
         $templatename="cat".$DataCategory->GetId().".tpl"; <br />
         <br />
         /**<br />
         *  in this call, smarty uses the static resources functions bellow and assigns  <br />
         *  variables to the template<br />
         *  note that the template was specified  just few lines above and is therefore specofic<br />
         *  for the data in every data class in  the DataCategories collection<br />
         */<br />
        <br />
         $ret= $this->smarty->fetch("text:$templatename");  <br />
     <br />
         return $ret;<br />
    }<br />
  <br />
    <br />
<br />
 public static function text_get_template($tpl_name, &amp;$tpl_source, &amp;$smarty)<br />
{<br />
/**<br />
*   uses the static variable assigned in the DisplayCategory function  <br />
*/<br />
<br />
if(!empty(self::$template)) {<br />
            $tpl_source=self::$template;<br />
            return true;<br />
}<br />
  <br />
        return false;<br />
<br />
}<br />
 <br />
 public static function text_get_timestamp($tpl_name, &amp;$tpl_timestamp, &amp;$smarty)<br />
{<br />
/**<br />
*  uses the static variable assigned in the DisplayCategory function <br />
*/<br />
<br />
if(!empty(self::$mktime)) {<br />
            $tpl_timestamp=self::$mktime;<br />
            return true;<br />
}<br />
  <br />
        return false;<br />
}<br />
<br />
 public static function text_get_secure($tpl_name, &amp;$smarty)<br />
{<br />
    // assume all templates are secure<br />
    return true;<br />
}<br />
<br />
 public static function text_get_trusted($tpl_name, &amp;$smarty)<br />
{<br />
    // not used for templates<br />
} <br />
<br />
  }<br />
?><br />
<br />
</code></p><div class="item_footer"><p><small><a href="http://www.webdnes.cz/blog/blog2.php/2009/12/23/smarty-resources-template-from-string">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.webdnes.cz/blog/blog2.php/2009/12/23/smarty-resources-template-from-string#comments</comments>
		</item>
				<item>
			<title>TinyMCE editor and EXT library - a troubled marriage</title>
			<link>http://www.webdnes.cz/blog/blog2.php/2009/07/14/tinymce-editor-and-ext-library-a-trouble</link>
			<pubDate>Mon, 13 Jul 2009 22:34:12 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">javascript</category>			<guid isPermaLink="false">3@http://www.webdnes.cz/blog/</guid>
						<description>&lt;p&gt;&lt;a href=&quot;http://tinymce.moxiecode.com/&quot;&gt;TinyMCE&lt;/a&gt;, together with the FCKeditor, is perhaps the best WYSIWYG editor available. &lt;a href=&quot;http://www.extjs.com/&quot;&gt;EXT 3&lt;/a&gt;, the recent version of EXT, is a cool  (but for certain licences paid) javascript library. EXT comes with its own WYSIWYG editor, but it is no match for TinyMCE. Naturally, one would like  to use these two together - TinyMCE for text input, EXT for creating trees, datagrids, dragging and a whole range of dynamic effects. To make life a bit more complicated, TinyMCE and EXT do not go along very well. So far I have noticed two issues:&lt;/p&gt;

&lt;p&gt;1.  TinyMCE converted textarea  + EXT drag and drop = the text disappears&lt;br /&gt;
2.  EXT TabPanel prevents TinyMCE init&lt;/p&gt;


&lt;p&gt;The first problem is in fact not directly connected to Ext.dd . The textarea was, together with other elements, embedded in a parent DIV and this DIV was moved manually by calling InsertBefore in the  &quot;notify drop&quot; function. Nevertheless, the text disappeared. The solution (I do not claim it is the best or the only way how to handle this problem) is&lt;br /&gt;
removing the particular textarea from TinyMce just before the textarea is moved around and adding it back after it is safely placed in the new position.&lt;/p&gt;

&lt;p&gt;Thus the set of commands is like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;notifyDrop: function(dd, e, data) {  &lt;br /&gt;
tinyMCE.execCommand('mceRemoveControl', false, TextAreaId); &lt;br /&gt;
Ext.fly('idDivMoved').insertBefore(SomeElement);  &lt;br /&gt;
tinyMCE.execCommand('mceAddControl', false, TextAreaId);     &lt;br /&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The second problem concerns the loading order, TinyMCE instance cannot be created before the particular Tab exist. Fortunately, the problem is well &lt;a href=&quot;http://extjs.com/forum/showthread.php?t=72364&quot;&gt;known and solved&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The code below is slightly different from the original and shows where to place the tinyMCE.init and how to select the tab using the id of element it is rendered to ('Atab' in this example)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;var tabs = new Ext.TabPanel({&lt;br /&gt;
        renderTo: 'tabs',&lt;br /&gt;
        width:780,&lt;br /&gt;
        activeTab: 0,&lt;br /&gt;
        frame:true,&lt;br /&gt;
        defaults:{autoHeight: true},&lt;br /&gt;
        items:[&lt;br /&gt;
            {contentEl:'Atab', title: 'A'},&lt;br /&gt;
            {contentEl:'Btab', title: 'B'} &lt;br /&gt;
        ],&lt;br /&gt;
        &lt;br /&gt;
        listeners: {&lt;br /&gt;
        tabchange : function(e) {&lt;br /&gt;
           var act = e.getActiveTab();&lt;br /&gt;
                    if (act.contentEl == 'Atab' &amp;amp;&amp;amp; descMceLoaded == false){&lt;br /&gt;
&lt;br /&gt;
                            tinyMCE.init({&lt;br /&gt;
                            mode : &quot;textareas&quot;,&lt;br /&gt;
                            theme : &quot;simple&quot;,&lt;br /&gt;
                            language : &quot;cs&quot;&lt;br /&gt;
                            });&lt;br /&gt;
                 &lt;br /&gt;
                    descMceLoaded = true; &lt;br /&gt;
                    }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;/code&gt;&lt;br /&gt;
    &lt;br /&gt;
 })&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.webdnes.cz/blog/blog2.php/2009/07/14/tinymce-editor-and-ext-library-a-trouble&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><a href="http://tinymce.moxiecode.com/">TinyMCE</a>, together with the FCKeditor, is perhaps the best WYSIWYG editor available. <a href="http://www.extjs.com/">EXT 3</a>, the recent version of EXT, is a cool  (but for certain licences paid) javascript library. EXT comes with its own WYSIWYG editor, but it is no match for TinyMCE. Naturally, one would like  to use these two together - TinyMCE for text input, EXT for creating trees, datagrids, dragging and a whole range of dynamic effects. To make life a bit more complicated, TinyMCE and EXT do not go along very well. So far I have noticed two issues:</p>

<p>1.  TinyMCE converted textarea  + EXT drag and drop = the text disappears<br />
2.  EXT TabPanel prevents TinyMCE init</p>


<p>The first problem is in fact not directly connected to Ext.dd . The textarea was, together with other elements, embedded in a parent DIV and this DIV was moved manually by calling InsertBefore in the  "notify drop" function. Nevertheless, the text disappeared. The solution (I do not claim it is the best or the only way how to handle this problem) is<br />
removing the particular textarea from TinyMce just before the textarea is moved around and adding it back after it is safely placed in the new position.</p>

<p>Thus the set of commands is like this:</p>

<p><code>notifyDrop: function(dd, e, data) {  <br />
tinyMCE.execCommand('mceRemoveControl', false, TextAreaId); <br />
Ext.fly('idDivMoved').insertBefore(SomeElement);  <br />
tinyMCE.execCommand('mceAddControl', false, TextAreaId);     <br />
}</code></p>

<p>The second problem concerns the loading order, TinyMCE instance cannot be created before the particular Tab exist. Fortunately, the problem is well <a href="http://extjs.com/forum/showthread.php?t=72364">known and solved</a>.</p>

<p>The code below is slightly different from the original and shows where to place the tinyMCE.init and how to select the tab using the id of element it is rendered to ('Atab' in this example)</p>

<p><code>var tabs = new Ext.TabPanel({<br />
        renderTo: 'tabs',<br />
        width:780,<br />
        activeTab: 0,<br />
        frame:true,<br />
        defaults:{autoHeight: true},<br />
        items:[<br />
            {contentEl:'Atab', title: 'A'},<br />
            {contentEl:'Btab', title: 'B'} <br />
        ],<br />
        <br />
        listeners: {<br />
        tabchange : function(e) {<br />
           var act = e.getActiveTab();<br />
                    if (act.contentEl == 'Atab' &amp;&amp; descMceLoaded == false){<br />
<br />
                            tinyMCE.init({<br />
                            mode : "textareas",<br />
                            theme : "simple",<br />
                            language : "cs"<br />
                            });<br />
                 <br />
                    descMceLoaded = true; <br />
                    }<br />
        }<br />
    }</code><br />
    <br />
 })</p><div class="item_footer"><p><small><a href="http://www.webdnes.cz/blog/blog2.php/2009/07/14/tinymce-editor-and-ext-library-a-trouble">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.webdnes.cz/blog/blog2.php/2009/07/14/tinymce-editor-and-ext-library-a-trouble#comments</comments>
		</item>
				<item>
			<title>Site Search Google Ajax API</title>
			<link>http://www.webdnes.cz/blog/blog2.php/2009/05/15/site-search-google-ajax-api-1</link>
			<pubDate>Fri, 15 May 2009 16:13:45 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">javascript</category>			<guid isPermaLink="false">2@http://www.webdnes.cz/blog/</guid>
						<description>&lt;p&gt;&lt;em&gt;This is a working example of Google Ajax Search API with custom form. The intended usage of the code is for running your own fully customised site restricted search with the help of Google API. Do not wish to read the full article? Just grab the code at the end of this post, replace  words &quot;your-API-key-there&quot; with real Google API key and change &quot;webdnes.cz&quot; to the url of your website&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I have been considering the possible solutions for implementing the full site search for the websites based on the CMS &lt;a href=&quot;http://www.webdnes.cz&quot;&gt;WebDnes&lt;/a&gt;. Suprisingly, although this is a general problem, I was unable to Google out a solution directly fitting my needs. Anyway, what are the possibilities?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Searching over a database.&lt;/strong&gt;&lt;br /&gt;
It seems like a nice solution, but it makes sense mostly in cases when we can rely on a consistent structure of individual items, e.g. for eshops. But for a flexible CMS it means relying on a suboptimal MySQL full text search performance. So this is not the way.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;So called parasite forms, e.g Google&lt;/strong&gt;&lt;br /&gt;
Apparently, this solution is very easy to implement. But I have certain doubts that website owners would enjoy search results routed OUTSIDE the website and interlaced with the ads of their competitors. Thus big NO again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Search AJAX API&lt;/strong&gt;&lt;br /&gt;
This solution feels really better. After a minor effort, I was able to google out a nice &lt;br /&gt;
 &lt;a href=&quot;http://code.google.com/apis/ajax/playground/#hello_world&quot; target=&quot;_blank&quot;&gt;example&lt;/a&gt;. After a little tweaking, the code worked approximately in the way I intended. If you copy paste the following code, it should work. Just add the proper API key and do not overlook the line options.setRoot, indicating the element to be filled by the results should go.&lt;/p&gt;


&lt;p&gt;&lt;code&gt;&lt;br /&gt;
&amp;lt;script src=&quot;http://www.google.com/jsapi?key=vas-api-key-patri-sem&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
    //&amp;lt;![CDATA[&lt;br /&gt;
             &lt;br /&gt;
    google.load(&quot;search&quot;, &quot;1&quot;, {&quot;language&quot; : &quot;cs&quot;});    &lt;br /&gt;
&lt;br /&gt;
    function OnLoad() {&lt;br /&gt;
     &lt;br /&gt;
      // Create a search control&lt;br /&gt;
      var searchControl = new google.search.SearchControl();&lt;br /&gt;
      searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);&lt;br /&gt;
      // site restricted web search with custom label&lt;br /&gt;
      // and class suffix&lt;br /&gt;
      var siteSearch = new google.search.WebSearch();&lt;br /&gt;
      siteSearch.setUserDefinedLabel(&quot;Webdnes.cz&quot;);&lt;br /&gt;
      siteSearch.setUserDefinedClassSuffix(&quot;siteSearch&quot;);&lt;br /&gt;
      siteSearch.setSiteRestriction(&quot;webdnes.cz&quot;);&lt;br /&gt;
      &lt;br /&gt;
     options = new google.search.SearcherOptions();&lt;br /&gt;
     options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);&lt;br /&gt;
     options.setRoot(document.getElementById(&quot;search&quot;));&lt;br /&gt;
&lt;br /&gt;
      searchControl.addSearcher(siteSearch, options);&lt;br /&gt;
     &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
      // tell the searcher to draw itself and tell it where to attach&lt;br /&gt;
      searchControl.draw(document.getElementById(&quot;searchcontrol&quot;));&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
    google.setOnLoadCallback(OnLoad);&lt;br /&gt;
&lt;br /&gt;
    //]]&amp;gt;&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;div id=&quot;searchcontrol&quot;&amp;gt;Loading...&amp;lt;/div&amp;gt;&lt;br /&gt;
     &lt;br /&gt;
        &amp;lt;div id=&quot;search&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom form using Google Search Ajax API&lt;/strong&gt;&lt;br /&gt;
There are still some minor problems with the code above.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Google will create a nice form, but there are no tools for customising its appearance&lt;/li&gt;
  &lt;li&gt;Google logo - well I personally like it but would not the website owners mind displying the log even in cases where no search was performed&lt;/li&gt;
  &lt;li&gt;Finally we can use options.setRoot to specify the element used for displaying the results. Sometimes, it would be convenient to replace the page content itself with the search results. Unfortunately, if we setRoot to the div element used to display the content of the page, it is set to zero, even if no search was made
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unfortunately it appears that the only way to get rid of these nuisances is to us the the crude search API. Originally I thought that it will be pretty easy to google out a working example, but it was not the case. The only code I found was &lt;a href=&quot;http://jgeerdes.home.mchsi.com/playground/gsearch3.html&quot;  target=&quot;_blank&quot;&gt;this one&lt;/a&gt; and it did not work properly - for every search term, the same set of results was returned. Not encouraging. Soon I gave up attempts to fix this  code and decided to make my own using Google AJAX search API &lt;a href=&quot;http://code.google.com/intl/cs/apis/ajaxsearch/documentation/reference.html#_class_GsearcherOptions&quot;&gt;documentation&lt;/a&gt; and &lt;a href=&quot;http://code.google.com/apis/ajax/playground/#raw_search&quot;&gt;the image search&lt;/a&gt; example. The code below should work properly, just enter your API key. You can see the code in action &lt;a href=&quot;http://www.rtservis.com&quot;&gt;there&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&amp;gt;&lt;br /&gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;My Google AJAX Search API Application&amp;lt;/title&amp;gt;&lt;br /&gt;
    &amp;lt;style type=&quot;text/css&quot;&amp;gt;&lt;br /&gt;
    .qw2 {color:#ff0000;font-weight:600;}   &lt;br /&gt;
    .qw3 {color:#aa0000;font-weight:300;}    &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/style&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
  &amp;lt;body&amp;gt;&lt;br /&gt;
   &amp;lt;script src=&quot;http://www.google.com/jsapi?key=your-API-key-there&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
    //&amp;lt;![CDATA[&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
*  The SearchControl manages searchers and draws a UI for them.  However,&lt;br /&gt;
*  searchers can be used by themselves without the SearchControl.  This is&lt;br /&gt;
*  called using a &quot;Raw Searcher&quot;.  When doing this, you must handle and draw&lt;br /&gt;
*  the search results manually.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
google.load('search', '1');&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
var webSearch;&lt;br /&gt;
var gSearch;&lt;br /&gt;
function addPaginationLinks() {&lt;br /&gt;
  // The cursor object has all things to do with pagination&lt;br /&gt;
  var cursor = webSearch.cursor;&lt;br /&gt;
  var curPage = cursor.currentPageIndex; // check what page the app is on&lt;br /&gt;
  var pagesDiv = document.createElement('div');&lt;br /&gt;
  for (var i = 0; i &amp;lt; cursor.pages.length; i++) {&lt;br /&gt;
    var page = cursor.pages[i];&lt;br /&gt;
    if (curPage == i) { // if we are on the curPage, then don't make a link&lt;br /&gt;
      var label = document.createTextNode(' ' + page.label + ' ');&lt;br /&gt;
      pagesDiv.appendChild(label);&lt;br /&gt;
    } else {&lt;br /&gt;
      // If we aren't on the current page, then we want a link to this page.&lt;br /&gt;
      // So we create a link that calls the gotoPage() method on the searcher.&lt;br /&gt;
      var link = document.createElement('a');&lt;br /&gt;
      link.href = 'javascript:webSearch.gotoPage('+i+');';&lt;br /&gt;
      link.innerHTML = page.label;&lt;br /&gt;
      link.style.marginRight = '2px';&lt;br /&gt;
      pagesDiv.appendChild(link);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  var contentDiv = document.getElementById('content');&lt;br /&gt;
  contentDiv.appendChild(pagesDiv);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function searchComplete() {&lt;br /&gt;
  // Check that we got results&lt;br /&gt;
   var contentDiv = document.getElementById('content'); &lt;br /&gt;
    contentDiv.innerHTML = '';     &lt;br /&gt;
  if (webSearch.results &amp;amp;&amp;amp; webSearch.results.length &amp;gt; 0) {&lt;br /&gt;
    // Grab our content div, clear it.&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    // Loop through our results, printing them to the page.&lt;br /&gt;
    var results = webSearch.results;&lt;br /&gt;
    for (var i = 0; i &amp;lt; results.length; i++) {&lt;br /&gt;
        var result = results[i];&lt;br /&gt;
        var resContainer = document.createElement('div');&lt;br /&gt;
        resContainer.className='gw1';&lt;br /&gt;
&lt;br /&gt;
       var title = document.createElement('div'); &lt;br /&gt;
       title.className='gw2';  &lt;br /&gt;
       titulek='&amp;lt;a href=&quot;' + result.url + '&quot;&amp;gt;' + result.title + '&amp;lt;/a&amp;gt;'; &lt;br /&gt;
       title.innerHTML = titulek;&lt;br /&gt;
       var content = document.createElement('div'); &lt;br /&gt;
       content.className='gw3';  &lt;br /&gt;
       content.innerHTML = result.content; &lt;br /&gt;
        &lt;br /&gt;
       /*  &lt;br /&gt;
      var newImg = document.createElement('img');&lt;br /&gt;
      // There is also a result.url property which has the escaped version&lt;br /&gt;
      newImg.src = result.tbUrl;&lt;br /&gt;
      */ &lt;br /&gt;
      resContainer.appendChild(title);&lt;br /&gt;
      resContainer.appendChild(content);  &lt;br /&gt;
     // imgContainer.appendChild(newImg);&lt;br /&gt;
       &lt;br /&gt;
      // Put our title + image in the content&lt;br /&gt;
      contentDiv.appendChild(resContainer);&lt;br /&gt;
     &lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Now add the paging links so the user can see more results.&lt;br /&gt;
    addPaginationLinks(webSearch);&lt;br /&gt;
&lt;br /&gt;
      //   setResultSetSize&lt;br /&gt;
 &lt;br /&gt;
      var b=   gSearch.getBranding();   &lt;br /&gt;
      contentDiv.insertBefore(b, contentDiv.firstChild); &lt;br /&gt;
  } &lt;br /&gt;
  else {&lt;br /&gt;
     contentDiv.innerHTML = 'no results';   &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function OnLoad() {&lt;br /&gt;
    gSearch= google.search.Search;&lt;br /&gt;
  // Our ImageSearch instance.&lt;br /&gt;
 // imageSearch = new google.search.ImageSearch();&lt;br /&gt;
   webSearch = new google.search.WebSearch();    &lt;br /&gt;
&lt;br /&gt;
  // Restrict to extra large images only&lt;br /&gt;
  webSearch.setSiteRestriction('www.webdnes.cz');&lt;br /&gt;
&lt;br /&gt;
   // Here we set a callback so that anytime a search is executed, it will call&lt;br /&gt;
   // the searchComplete function and pass it our WebSearch searcher.&lt;br /&gt;
  &lt;br /&gt;
      webSearch.setResultSetSize(gSearch.LARGE_RESULTSET); &lt;br /&gt;
      //searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);     &lt;br /&gt;
      //gSearch.setNoResultsString(gSearch.NO_RESULTS_DEFAULT_STRING);  &lt;br /&gt;
      &lt;br /&gt;
     webSearch.setSearchCompleteCallback(this, searchComplete, null);&lt;br /&gt;
     var query = document.getElementById(&quot;q&quot;);&lt;br /&gt;
         &lt;br /&gt;
      webSearch.execute(query.value);    &lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//google.setOnLoadCallback(OnLoad); &lt;br /&gt;
  &lt;br /&gt;
 &lt;br /&gt;
    //]]&amp;gt; &amp;lt;/script&amp;gt;    &lt;br /&gt;
    &lt;br /&gt;
&amp;lt;form onSubmit=&quot;OnLoad();return false;&quot;&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;text&quot; id=&quot;q&quot;&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;submit&quot; value=&quot;vyhledat&quot; name=&quot;cmdSubmit&quot;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;div id=&quot;content&quot;&amp;gt;original content of this page&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.webdnes.cz/blog/blog2.php/2009/05/15/site-search-google-ajax-api-1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><em>This is a working example of Google Ajax Search API with custom form. The intended usage of the code is for running your own fully customised site restricted search with the help of Google API. Do not wish to read the full article? Just grab the code at the end of this post, replace  words "your-API-key-there" with real Google API key and change "webdnes.cz" to the url of your website</em></p>

<p>I have been considering the possible solutions for implementing the full site search for the websites based on the CMS <a href="http://www.webdnes.cz">WebDnes</a>. Suprisingly, although this is a general problem, I was unable to Google out a solution directly fitting my needs. Anyway, what are the possibilities?</p>

<p><strong>Searching over a database.</strong><br />
It seems like a nice solution, but it makes sense mostly in cases when we can rely on a consistent structure of individual items, e.g. for eshops. But for a flexible CMS it means relying on a suboptimal MySQL full text search performance. So this is not the way.</p>


<p><strong>So called parasite forms, e.g Google</strong><br />
Apparently, this solution is very easy to implement. But I have certain doubts that website owners would enjoy search results routed OUTSIDE the website and interlaced with the ads of their competitors. Thus big NO again.</p>

<p><strong>Google Search AJAX API</strong><br />
This solution feels really better. After a minor effort, I was able to google out a nice <br />
 <a href="http://code.google.com/apis/ajax/playground/#hello_world" target="_blank">example</a>. After a little tweaking, the code worked approximately in the way I intended. If you copy paste the following code, it should work. Just add the proper API key and do not overlook the line options.setRoot, indicating the element to be filled by the results should go.</p>


<p><code><br />
&lt;script src="http://www.google.com/jsapi?key=vas-api-key-patri-sem" type="text/javascript"&gt;&lt;/script&gt;<br />
    &lt;script language="Javascript" type="text/javascript"&gt;<br />
    //&lt;![CDATA[<br />
             <br />
    google.load("search", "1", {"language" : "cs"});    <br />
<br />
    function OnLoad() {<br />
     <br />
      // Create a search control<br />
      var searchControl = new google.search.SearchControl();<br />
      searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);<br />
      // site restricted web search with custom label<br />
      // and class suffix<br />
      var siteSearch = new google.search.WebSearch();<br />
      siteSearch.setUserDefinedLabel("Webdnes.cz");<br />
      siteSearch.setUserDefinedClassSuffix("siteSearch");<br />
      siteSearch.setSiteRestriction("webdnes.cz");<br />
      <br />
     options = new google.search.SearcherOptions();<br />
     options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);<br />
     options.setRoot(document.getElementById("search"));<br />
<br />
      searchControl.addSearcher(siteSearch, options);<br />
     <br />
      <br />
<br />
      // tell the searcher to draw itself and tell it where to attach<br />
      searchControl.draw(document.getElementById("searchcontrol"));<br />
<br />
    }<br />
    google.setOnLoadCallback(OnLoad);<br />
<br />
    //]]&gt;<br />
    &lt;/script&gt;<br />
    &lt;div id="searchcontrol"&gt;Loading...&lt;/div&gt;<br />
     <br />
        &lt;div id="search"&gt;&lt;/div&gt;</code></p>

<p><strong>Custom form using Google Search Ajax API</strong><br />
There are still some minor problems with the code above.</p>
<ul>
  <li>Google will create a nice form, but there are no tools for customising its appearance</li>
  <li>Google logo - well I personally like it but would not the website owners mind displying the log even in cases where no search was performed</li>
  <li>Finally we can use options.setRoot to specify the element used for displaying the results. Sometimes, it would be convenient to replace the page content itself with the search results. Unfortunately, if we setRoot to the div element used to display the content of the page, it is set to zero, even if no search was made
</li>
</ul>

<p>Unfortunately it appears that the only way to get rid of these nuisances is to us the the crude search API. Originally I thought that it will be pretty easy to google out a working example, but it was not the case. The only code I found was <a href="http://jgeerdes.home.mchsi.com/playground/gsearch3.html"  target="_blank">this one</a> and it did not work properly - for every search term, the same set of results was returned. Not encouraging. Soon I gave up attempts to fix this  code and decided to make my own using Google AJAX search API <a href="http://code.google.com/intl/cs/apis/ajaxsearch/documentation/reference.html#_class_GsearcherOptions">documentation</a> and <a href="http://code.google.com/apis/ajax/playground/#raw_search">the image search</a> example. The code below should work properly, just enter your API key. You can see the code in action <a href="http://www.rtservis.com">there</a></p>


<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;<br />
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />
  &lt;head&gt;<br />
    &lt;title&gt;My Google AJAX Search API Application&lt;/title&gt;<br />
    &lt;style type="text/css"&gt;<br />
    .qw2 {color:#ff0000;font-weight:600;}   <br />
    .qw3 {color:#aa0000;font-weight:300;}    <br />
 <br />
 &lt;/style&gt;<br />
  &lt;/head&gt;<br />
  &lt;body&gt;<br />
   &lt;script src="http://www.google.com/jsapi?key=your-API-key-there" type="text/javascript"&gt;&lt;/script&gt;<br />
    &lt;script language="Javascript" type="text/javascript"&gt;<br />
    //&lt;![CDATA[<br />
<br />
<br />
/*<br />
*  The SearchControl manages searchers and draws a UI for them.  However,<br />
*  searchers can be used by themselves without the SearchControl.  This is<br />
*  called using a "Raw Searcher".  When doing this, you must handle and draw<br />
*  the search results manually.<br />
*/<br />
<br />
google.load('search', '1');<br />
<br />
<br />
<br />
var webSearch;<br />
var gSearch;<br />
function addPaginationLinks() {<br />
  // The cursor object has all things to do with pagination<br />
  var cursor = webSearch.cursor;<br />
  var curPage = cursor.currentPageIndex; // check what page the app is on<br />
  var pagesDiv = document.createElement('div');<br />
  for (var i = 0; i &lt; cursor.pages.length; i++) {<br />
    var page = cursor.pages[i];<br />
    if (curPage == i) { // if we are on the curPage, then don't make a link<br />
      var label = document.createTextNode(' ' + page.label + ' ');<br />
      pagesDiv.appendChild(label);<br />
    } else {<br />
      // If we aren't on the current page, then we want a link to this page.<br />
      // So we create a link that calls the gotoPage() method on the searcher.<br />
      var link = document.createElement('a');<br />
      link.href = 'javascript:webSearch.gotoPage('+i+');';<br />
      link.innerHTML = page.label;<br />
      link.style.marginRight = '2px';<br />
      pagesDiv.appendChild(link);<br />
    }<br />
  }<br />
<br />
  var contentDiv = document.getElementById('content');<br />
  contentDiv.appendChild(pagesDiv);<br />
}<br />
<br />
function searchComplete() {<br />
  // Check that we got results<br />
   var contentDiv = document.getElementById('content'); <br />
    contentDiv.innerHTML = '';     <br />
  if (webSearch.results &amp;&amp; webSearch.results.length &gt; 0) {<br />
    // Grab our content div, clear it.<br />
   <br />
    <br />
<br />
    // Loop through our results, printing them to the page.<br />
    var results = webSearch.results;<br />
    for (var i = 0; i &lt; results.length; i++) {<br />
        var result = results[i];<br />
        var resContainer = document.createElement('div');<br />
        resContainer.className='gw1';<br />
<br />
       var title = document.createElement('div'); <br />
       title.className='gw2';  <br />
       titulek='&lt;a href="' + result.url + '"&gt;' + result.title + '&lt;/a&gt;'; <br />
       title.innerHTML = titulek;<br />
       var content = document.createElement('div'); <br />
       content.className='gw3';  <br />
       content.innerHTML = result.content; <br />
        <br />
       /*  <br />
      var newImg = document.createElement('img');<br />
      // There is also a result.url property which has the escaped version<br />
      newImg.src = result.tbUrl;<br />
      */ <br />
      resContainer.appendChild(title);<br />
      resContainer.appendChild(content);  <br />
     // imgContainer.appendChild(newImg);<br />
       <br />
      // Put our title + image in the content<br />
      contentDiv.appendChild(resContainer);<br />
     <br />
    }<br />
<br />
    // Now add the paging links so the user can see more results.<br />
    addPaginationLinks(webSearch);<br />
<br />
      //   setResultSetSize<br />
 <br />
      var b=   gSearch.getBranding();   <br />
      contentDiv.insertBefore(b, contentDiv.firstChild); <br />
  } <br />
  else {<br />
     contentDiv.innerHTML = 'no results';   <br />
  }<br />
}<br />
<br />
 <br />
<br />
<br />
function OnLoad() {<br />
    gSearch= google.search.Search;<br />
  // Our ImageSearch instance.<br />
 // imageSearch = new google.search.ImageSearch();<br />
   webSearch = new google.search.WebSearch();    <br />
<br />
  // Restrict to extra large images only<br />
  webSearch.setSiteRestriction('www.webdnes.cz');<br />
<br />
   // Here we set a callback so that anytime a search is executed, it will call<br />
   // the searchComplete function and pass it our WebSearch searcher.<br />
  <br />
      webSearch.setResultSetSize(gSearch.LARGE_RESULTSET); <br />
      //searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);     <br />
      //gSearch.setNoResultsString(gSearch.NO_RESULTS_DEFAULT_STRING);  <br />
      <br />
     webSearch.setSearchCompleteCallback(this, searchComplete, null);<br />
     var query = document.getElementById("q");<br />
         <br />
      webSearch.execute(query.value);    <br />
  <br />
}<br />
<br />
<br />
//google.setOnLoadCallback(OnLoad); <br />
  <br />
 <br />
    //]]&gt; &lt;/script&gt;    <br />
    <br />
&lt;form onSubmit="OnLoad();return false;"&gt;<br />
&lt;input type="text" id="q"&gt;<br />
&lt;input type="submit" value="vyhledat" name="cmdSubmit"&gt;<br />
&lt;/form&gt;<br />
    <br />
&lt;div id="content"&gt;original content of this page&lt;/div&gt;</code></p><div class="item_footer"><p><small><a href="http://www.webdnes.cz/blog/blog2.php/2009/05/15/site-search-google-ajax-api-1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.webdnes.cz/blog/blog2.php/2009/05/15/site-search-google-ajax-api-1#comments</comments>
		</item>
			</channel>
</rss>
