<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><language>en</language><title>Blog posts by LinhDo</title> <link>https://world.optimizely.com/blogs/LinhDo/</link><description></description><ttl>60</ttl><generator>Optimizely World</generator><item> <title>Add Google search box to CMS site using Dynamic content</title>            <link>https://world.optimizely.com/blogs/LinhDo/Dates/2010/11/Add-Google-search-box-to-CMS-site-using-Dynamic-content/</link>            <description>&lt;p&gt;Developers all know how easy to add a Google search box to their website. But with me, it only get attractive when I verify an issue regarding to Dynamic Content, when I found that Dynamic Content is really nice feature. So I try to create my first Dynamic content with Google search box.&lt;/p&gt;  &lt;p&gt;This entry shows a sample to create your own custom search engine using Google Custom Search and Dynamic Content in CMS template pages.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;1. &lt;/b&gt;&lt;b&gt;Get Search Engine ID&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;You should login to your Google Account first then go to &lt;a href=&quot;http://www.google.com/cse/&quot;&gt;http://www.google.com/cse/&lt;/a&gt; to create your custom search engine. After that go to Control Panel link and get your Search engine unique ID. It looks like this &lt;font color=&quot;#f79646&quot;&gt;&lt;i&gt;007791610224680591377:m3lgrymjnfy&lt;/i&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;font color=&quot;#f79646&quot;&gt;&lt;/font&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;2. &lt;/b&gt;&lt;b&gt;Create GoogleSearch Dynamic Content&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;I create settings for this Dynamic Content with a User Control to save search site. The settings interface looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/ec1c7995a657490d9a909d506959e3da.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/3c5a6fac72204592987f7b74dd08ed30.png&quot; width=&quot;370&quot; height=&quot;131&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can input your site name for the second search-site option (the first one will be all sites).&lt;/p&gt;  &lt;p&gt;And one more user control to display the search box. Note that you have to put your key – that get from step 1 to &lt;font color=&quot;#0000ff&quot;&gt;cx&lt;/font&gt; value here&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;asp&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;:&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;HiddenField&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;ID&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&amp;quot;cx&amp;quot;&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;Value&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&amp;quot;Put You Key Here&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt; runat&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/font&gt;&lt;/span&gt; &lt;/font&gt;&lt;span&gt;&lt;font style=&quot;font-size: 10pt&quot; color=&quot;#0000ff&quot;&gt;/&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color=&quot;#0000ff&quot;&gt;cx&lt;/font&gt; = The identifier of the custom search engine.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This code below is to show the result from Google (provide by Google custom search engine)&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;div&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;id&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&amp;quot;ResultArea&amp;quot;&amp;gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#a31515&quot;&gt;div&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style=&quot;font-size: 10pt&quot; color=&quot;#0000ff&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;script&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;type&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style=&quot;font-size: 10pt&quot; color=&quot;#0000ff&quot;&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;var&lt;/font&gt;&lt;/span&gt; googleSearchIframeName = &lt;span&gt;&lt;font color=&quot;#a31515&quot;&gt;&amp;quot;ResultArea&amp;quot;&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;var&lt;/font&gt;&lt;/span&gt; googleSearchFrameborder = 0;&lt;/font&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;var&lt;/font&gt;&lt;/span&gt; googleSearchDomain =&lt;span&gt;&lt;font color=&quot;#a31515&quot;&gt;&amp;quot;www.google.com&amp;quot;&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;var&lt;/font&gt;&lt;/span&gt; googleSearchPath =&lt;span&gt;&lt;font color=&quot;#a31515&quot;&gt;&amp;quot;/cse&amp;quot;&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;span style=&quot;mso-spacerun: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;#160; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;script&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;script&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;type&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;src&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style=&quot;font-size: 10pt&quot; color=&quot;#0000ff&quot;&gt;=&amp;quot;http://www.google.com/afsonline/show_afs_search.js&amp;quot;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here we go, &lt;strong&gt;Google search box in CMS site&lt;/strong&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/04b460c10f9749f39dfca1fb305649e6.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/01a45dec8de8451796ac4153b86f0c33.png&quot; width=&quot;385&quot; height=&quot;329&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Download full source code here:&lt;/b&gt;&lt;/p&gt;  &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:523d5096-b036-41e7-b3bd-2b25f6aa60db&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;&lt;p&gt; &lt;a href=&quot;/link/a17e3081c6f441e68fa915f2db217cce.zip&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;  &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:54afba3a-b24b-4fbe-bb4e-3bdc82ac09c1&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;&lt;p&gt; &lt;a href=&quot;/link/3def2530678a455d926fc8d4622c84dc.zip&quot;&gt;DynamicContentSample.zip&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin-left: 0cm; margin-right: 0cm&quot;&gt;&lt;font face=&quot;Times New Roman&quot;&gt;&lt;span style=&quot;mso-ansi-language: en-us&quot; lang=&quot;EN-US&quot;&gt;&lt;font style=&quot;font-size: 12pt&quot;&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Unzip and copy all files to Templates/DynamicContent folder then register the control in episerver.config: &lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style=&quot;line-height: normal; list-style-type: disc; margin: 0cm 0cm 0pt; mso-layout-grid-align: none&quot; class=&quot;MsoNormal&quot;&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#a31515&quot;&gt;add&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#ff0000&quot;&gt;description&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;quot;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;Google Search&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt; &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#ff0000&quot;&gt;name&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;Google Search&lt;/font&gt;&lt;/span&gt;&amp;quot; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#ff0000&quot;&gt;type&lt;/font&gt;&lt;/span&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;=&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: ; mso-no-proof: yes&quot;&gt;&lt;font style=&quot;font-size: 10pt&quot;&gt;&amp;quot;&lt;span&gt;&lt;font color=&quot;#0000ff&quot;&gt;GoogleSearch, EPiServer.Templates.Public&lt;/font&gt;&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;span&gt;&lt;font style=&quot;font-size: 10pt&quot; color=&quot;#0000ff&quot;&gt; /&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Dynamic Content is very useful feature for editors. Hope that next time I can do this with Google map. &lt;/p&gt;</description>            <guid>https://world.optimizely.com/blogs/LinhDo/Dates/2010/11/Add-Google-search-box-to-CMS-site-using-Dynamic-content/</guid>            <pubDate>Wed, 17 Nov 2010 06:46:00 GMT</pubDate>           <category>Blog post</category></item></channel>
</rss>