<?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>Money-Code &#187; widget</title>
	<atom:link href="http://www.money-code.com/tag/widget/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.money-code.com</link>
	<description>Coding For Online Success</description>
	<lastBuildDate>Fri, 12 Feb 2010 18:27:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dynamically create eBay widgets from existing rover code</title>
		<link>http://www.money-code.com/2007/11/dynamically-create-ebay-widgets-from-existing-rover-code/</link>
		<comments>http://www.money-code.com/2007/11/dynamically-create-ebay-widgets-from-existing-rover-code/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 22:40:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Affiliate Marketing]]></category>
		<category><![CDATA[EPN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rover]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p>Today, I read about the <a href="http://www.money-code.com/target/ebaywidget.php" target="_blank" rel="nofollow">eBay widget</a>. At first I was super stoked on the concept, and they look great. Here is a working example of the widget:</p>

<p><script type="text/javascript" src="http://www.money-code.com/files/swfobject.js"></script>
<p id="widget" align="center">No Flash? What's wrong with you?</p>
<script type="text/javascript">
var s0 = new SWFObject("http://togo.ebay.com/togo/togo.swf?2007111900","single","355","300","7");
s0.addVariable("base","http://togo.ebay.com/togo/&#038;lang=en-us&#038;mode=search&#038;query=star+wars&#038;pid=2631219");
s0.addVariable("width","355");
s0.addVariable("height","300");
s0.write("widget");
</script></p>

<p>Now my issue is this, it seems like you might be missing out on cookies since visitors might be viewing all the auction info directly from the widget vs going to eBay, and you would missing out on the cookie and affliate tracking. My initial tests with FireFox and Live HTTP headers seem to stress that cookie generation only occurs when you click 'View &#038; Bid' in the widget. The jury is still out on this, and hopefully people will share some of their success and failures to help others make good decisions when it comes to the widget. I'm going to try to post any useful results as they occur.</p>



Related posts:<ol><li><a href='http://www.money-code.com/2009/05/roverize-ebay-links-on-the-fly/' rel='bookmark' title='Permanent Link: Roverize eBay links on the fly'>Roverize eBay links on the fly</a></li>
<li><a href='http://www.money-code.com/2007/11/using-ffmpeg-to-create-youtube-clone-script/' rel='bookmark' title='Permanent Link: Using FFMpeg to create YouTube clone script'>Using FFMpeg to create YouTube clone script</a></li>
<li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Permanent Link: Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.money-code.com%2F2007%2F11%2Fdynamically-create-ebay-widgets-from-existing-rover-code%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.money-code.com%2F2007%2F11%2Fdynamically-create-ebay-widgets-from-existing-rover-code%2F" height="61" width="51" /></a></div><p>Today, I read about the <a href="http://www.money-code.com/target/ebaywidget.php" target="_blank" rel="nofollow">eBay widget</a>. At first I was super stoked on the concept, and they look great. Here is a working example of the widget:</p>
<p><script type="text/javascript" src="http://www.money-code.com/files/swfobject.js"></script></p>
<p id="widget" align="center">No Flash? What&#8217;s wrong with you?</p>
<p><script type="text/javascript">
var s0 = new SWFObject("http://togo.ebay.com/togo/togo.swf?2007111900","single","355","300","7");
s0.addVariable("base","http://togo.ebay.com/togo/&#038;lang=en-us&#038;mode=search&#038;query=star+wars&#038;pid=2631219");
s0.addVariable("width","355");
s0.addVariable("height","300");
s0.write("widget");
</script></p>
<p>Now my issue is this, it seems like you might be missing out on cookies since visitors might be viewing all the auction info directly from the widget vs going to eBay, and you would missing out on the cookie and affliate tracking. My initial tests with FireFox and Live HTTP headers seem to stress that cookie generation only occurs when you click &#8216;View &#038; Bid&#8217; in the widget. The jury is still out on this, and hopefully people will share some of their success and failures to help others make good decisions when it comes to the widget. I&#8217;m going to try to post any useful results as they occur.</p>
<p><!--break--></p>
<p>In the meantime, I thought I&#8217;d give up this simple little function that will convert inputted rover code into the widget. This could be useful if you have content stored in the database with rover code embedded. You&#8217;ll need to download the <a href="http://www.money-code.com/files/swfobject.js" target="_blank">swfobject.js</a> file to help with IE browsers display object/embed tags.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span><br />
<a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">&quot;PID&quot;</span>, <span class="st0">&quot;123456790&quot;</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> convertEbayNew<span class="br0">&#40;</span><span class="re0">$inLink</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$showWidget</span>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$out</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$inLink</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/eregi"><span class="kw3">eregi</span></a><span class="br0">&#40;</span><span class="st0">&quot;(.*cgi.ebay.com.*)&quot;</span>,<span class="re0">$inLink</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$itemID</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$arr</span>&nbsp; &nbsp; = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;QQ&#8217;</span>,<span class="re0">$inLink</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="re0">$x</span> = <span class="nu0">0</span>; <span class="re0">$x</span> &lt; <a href="http://www.php.net/sizeof"><span class="kw3">sizeof</span></a><span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span>; <span class="re0">$x</span>++<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/ereg"><span class="kw3">ereg</span></a><span class="br0">&#40;</span><span class="st0">&#8216;(^itemZ)&#8217;</span>,<span class="re0">$arr</span><span class="br0">&#91;</span><span class="re0">$x</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$item</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;itemZ&#8217;</span>,<span class="re0">$arr</span><span class="br0">&#91;</span><span class="re0">$x</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/is_numeric"><span class="kw3">is_numeric</span></a><span class="br0">&#40;</span><span class="re0">$item</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$itemID</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; = <span class="re0">$item</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$item</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">&#40;</span><span class="re0">$arr</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$showWidget</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/strlen"><span class="kw3">strlen</span></a><span class="br0">&#40;</span><a href="http://www.php.net/trim"><span class="kw3">trim</span></a><span class="br0">&#40;</span><span class="re0">$itemID</span><span class="br0">&#41;</span><span class="br0">&#41;</span> &gt; <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$xid</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><a href="http://www.php.net/md5"><span class="kw3">md5</span></a><span class="br0">&#40;</span><a href="http://www.php.net/uniqid"><span class="kw3">uniqid</span></a><span class="br0">&#40;</span><a href="http://www.php.net/rand"><span class="kw3">rand</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>,<span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span>,<span class="nu0">0</span>,<span class="nu0">8</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$out</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = <span class="st0">&#8216;&lt;p id=&quot;widget&#8217;</span>.<span class="re0">$xid</span>.<span class="st0">&#8216;&quot; align=&quot;center&quot;&gt;&#8217;</span>.<span class="re0">$out</span>.<span class="st0">&#8216;&lt;/p&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;script type=&quot;text/javascript&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var s0 = new SWFObject(&quot;http://togo.ebay.com/togo/togo.swf?2007111512&quot;,&quot;single&quot;,&quot;355&quot;,&quot;300&quot;,&quot;7&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s0.addVariable(&quot;base&quot;,&quot;http://togo.ebay.com/togo/&amp;lang=en-us&amp;mode=normal&amp;itemid=&#8217;</span>.<span class="re0">$itemID</span>.<span class="st0">&#8216;&amp;query=your+query&amp;pid=&#8217;</span>.PID.<span class="st0">&#8216;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s0.addVariable(&quot;width&quot;,&quot;355&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s0.addVariable(&quot;height&quot;,&quot;300&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s0.write(&quot;widget&#8217;</span>.<span class="re0">$xid</span>.<span class="st0">&#8216;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/script&gt;&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$out</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">?&gt;</span><br />
&lt;script type=<span class="st0">&quot;text/javascript&quot;</span> src=<span class="st0">&quot;swfobject.js&quot;</span>&gt;&lt;/script&gt;<br />
<span class="kw2">&lt;?php</span> <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> convertEbayNew<span class="br0">&#40;</span><span class="re0">$link</span><span class="br0">&#41;</span>;?&gt;<br />
&nbsp;</div>
<p>It&#8217;s pretty simple, and you could easily expand this to auto generate widgets in a forum (hint, look at preg_replace_callback()). If you have any thoughts, please comment here. There is also a DigitalPoint thread here that has a <a href="http://forums.digitalpoint.com/showthread.php?t=564290" target="_blank">dicussion about this now</a>.</p>


<p>Related posts:<ol><li><a href='http://www.money-code.com/2009/05/roverize-ebay-links-on-the-fly/' rel='bookmark' title='Permanent Link: Roverize eBay links on the fly'>Roverize eBay links on the fly</a></li>
<li><a href='http://www.money-code.com/2007/11/using-ffmpeg-to-create-youtube-clone-script/' rel='bookmark' title='Permanent Link: Using FFMpeg to create YouTube clone script'>Using FFMpeg to create YouTube clone script</a></li>
<li><a href='http://www.money-code.com/2007/09/using-ebays-api-to-search-auctions-and-return-results/' rel='bookmark' title='Permanent Link: Using eBay&#8217;s API to search auctions and return results'>Using eBay&#8217;s API to search auctions and return results</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.money-code.com/2007/11/dynamically-create-ebay-widgets-from-existing-rover-code/feed/</wfw:commentRss>
		<slash:comments>0</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! -->