OK it works but maybe I'm doing something wrong because I end up with 2 
search boxes.

Step 1
1. I created the tiddler with your code - and I think that tiddler 
functions as a macro?
2. I give the tiddler an appropriate name - I'm just using yours right now
3. I end up with a tiddler with a Google search box that works normally.

Step 2
1. I create another Tiddler and "call" the macro using my Google code - 
<<tiddler "search" with: "005363762118272804545:_p_mxkqgbak">>
2. I end up with another Tiddler with a Google search box that uses my 
parameters.

That's perfect!

However, why do I have to have 2 search boxes or can I put my google code 
somewhere in your Macro code?

You can see the results in this TW  -  in the Timeline - 
http://wikis.healthwealthandmusic.co.uk/worldwideweb.html




On Wednesday, January 30, 2013 12:05:50 PM UTC, Kev Richards wrote:
>
> That looks excellent, just the job - I'll try it later on when I get time.
>
> On Wednesday, January 30, 2013 12:31:15 AM UTC, Tobias Beer wrote:
>>
>> Hi everyone,
>>
>> as Kev was asking here [1] how to embed some fancy google code to embed a 
>> custom search, I went a different road. Hopefully, achieving the same 
>> desired outcome.
>>
>> So, here's what I did: Allow the user input his search term(s) and open a 
>> new window with the constructed search URL.
>>
>> So, in order to get any desired number of custom google search boxes 
>> working in a TiddlyWiki, here's what you do:
>>
>> A) Create a tiddler, perhaps called *[[Google Search]],* containing:
>> <html>
>> <span class="g-search">
>> <input class="g-search-input" type="text" id="$1"/>
>> <input class="g-search-button" type="button" value="search" 
>> onclick="javascript:
>>   var el = document.getElementById('$1');
>>   window.open('http://www.google.com/cse?cx=$1&q='+el.value, '_blank');
>>   window.focus();
>> "/>
>> </span>
>> </html>
>>
>> B) Now you can embed your desired search box in any tiddler using 
>> transclusion:
>> <<tiddler "Google Search" with: "YourCustom:SearchId">>
>>
>> So, what is going on here?
>>
>> For one, the *[[Google Search]]* tiddler is plain html with a button 
>> having an onclick handler, so it does something when you click it. In this 
>> case, open a new window in order to perform a custom google search.
>>
>> When TiddlyWiki outputs the *[[Google Search]]* tiddler - when it 
>> renders the tiddler where you have embedded it - it substitutes every 
>> occurence of $1 in the html snippet with whatever you passed as the 
>> first parameter to the <<tiddler>> macro. Likewise it would substitute 
>> any $2 with a second parameter, if there was any.
>>
>> Finally, if you want the thing to look pretty, you can make use of the 
>> css classes in your StyleSheet tiddler.
>>
>> Cheers, Tobias.
>>
>>
>> [1] 
>> https://groups.google.com/forum/?fromgroups=#!topic/tiddlywiki/badQG8RBGMM
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to