Take a look at this line:if (keyvalue[0] && keyvalue[0].toLowerCase() ==
"q") {

This is the line that checks for the q=yourqueryhere in the URL.  If you
alter this logic to include "title" and then return the value of it in that
function, you could pass the value to your queryList.

No, yourQueryHere does not have to be all one word, it can have spaces.
 They should be url encoded, though, and the encoded string for a space is
%20.  So a query for "President Obama" should be q=President%20Obama in the
url.

-Ben

On Mon, Mar 30, 2009 at 12:40 PM, webmaster <[email protected]>wrote:

>
> Ben
>
> thank you for the great hint. It works!
> In case I wanted to extend it so that also the title is dependent on
> the URL, how should I change the code?
>
> Can 'yourQueryHere' include also spaces? I have issued some queries
> but sometimes with poor results when the string 'yourQueryHere'
> contains spaces...
>
> thanks again
>
> On 30/03/2009, at 16.06, Ben Lisbakken wrote:
>
> >
> > Hey webmaster --
> >
> > Try doing using this code:
> > http://www.paste-it.net/public/s3ce8e9/
> >
> > And when you call your script, add ?q=yourQueryHere to your URL.
> >
> > -Ben
> >
> > On Mar 26, 11:36 am, webmaster <[email protected]> wrote:
> >> I would like a snow section where the topic changes dynamically,
> >> depending on a parameter in the url or in the myql database.
> >>
> >> In the script below I would like to be able to change the parameter
> >> "q". Any hints on how to do that?
> >>
> >>    <script src="http://www.google.com/jsapi?
> >>         key=<key>""></script>
> >>      <script type="text/javascript">
> >>      /*
> >>       * The Google NewsShow embeds a news slideshow on your page,
> >> letting your users see headlines
> >>       * and previews of Google News Search results, based on queries
> >> that you've selected.
> >>       *
> >>       * This sample will show how to specify queries for the News
> >> Show.
> >>       *
> http://code.google.com/apis/ajaxsearch/documentation/newsshow.html
> >>      */
> >>
> >>      google.load("elements", "1", {packages : ["newsshow"]});
> >>
> >>      function onLoad() {
> >>        // Set the queries to USC Football and NHL
> >>        var options = {
> >>          "queryList" : [
> >>            {
> >>              "title" : "Crisi Economica",
> >>              "q" : "Crisi Economica in Italia"
> >>            },
> >>            {
> >>              "q" : "Crisi Economica in Italia"
> >>            }
> >>          ]
> >>        }
> >>        var content = document.getElementById('content');
> >>        var newsShow = new google.elements.NewsShow(content, options);
> >>      }
> >>
> >>      google.setOnLoadCallback(onLoad);
> >>      </script>
> > >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to