<?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>Designer Sandbox &#187; Code</title>
	<atom:link href="http://www.designersandbox.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.designersandbox.com</link>
	<description>Online Tips for Web Developer/Designer</description>
	<lastBuildDate>Thu, 26 Jan 2012 09:33:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Centering a div block without the width using pure CSS (All Browser)</title>
		<link>http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/</link>
		<comments>http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 09:32:13 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Sharing]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1790</guid>
		<description><![CDATA[Easiest way to centering a div using pure CSS The trick to center the div is to shift the outer and inner div, with the use of position:relative and display:block. Shift the outer block 50% left relative, and then next is to move the inner block back to -50% left. Hope this make sense. This [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1790"><div class="steps">
<h3>Easiest way to centering a div using pure CSS</h3>
<p>The trick to center the div is to shift the outer and inner div, with the use of position:relative and display:block. Shift the outer block 50% left relative, and then next is to move the inner block back to -50% left. Hope this make sense. This code will work on all browser.</p>
</div>
<p><span id="more-1790"></span></p>
<p><a href="http://demo.designersandbox.com/centercss/index.html" target="_blank">DEMO</a></p>
<div class="steps">
<h3>html</h3>
<pre class="brush: xml;">
&lt;body class=&quot;ds&quot;&gt;
    &lt;div class=&quot;wrapper&quot;&gt;
        &lt;div class=&quot;outer&quot;&gt;
            &lt;div class=&quot;inner&quot;&gt;Centering the DIV&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/body&gt;
</pre>
</div>
<div class="steps">
<h3>css</h3>
<pre class="brush: css;">
.ds {
    margin:0;
    padding:0;
}
div.wrapper{
    float: left;
    overflow: hidden;
    position: relative;
    width: 100%;
    background:#00F;
    padding:10px;
    margin:0 -20px;
}
div.outer{
    clear: left;
    float: left;
    left: 50%;
    list-style: none outside none;
    margin: 0;
    padding: 0;
    position: relative;
    text-align: center;
}
div.inner{
    display: block;
    float: left;
    margin: 0;
    padding: 0;
    position: relative;
    right: 50%;
    color:#FFF;
    padding:5px 20px;
    background:#900;
    border:1px dotted #cccccc;
}
</pre>
</div>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1790&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li><li><a href="http://www.designersandbox.com/code/how-to-make-a-proper-css-button/" title="How to make a proper CSS button">How to make a proper CSS button</a> (1)</li><li><a href="http://www.designersandbox.com/code/creating-a-drop-search-filter-like-vimeo/" title="Creating a Drop Search Filter like Vimeo">Creating a Drop Search Filter like Vimeo</a> (3)</li><li><a href="http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/" title="Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack">Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</a> (1)</li><li><a href="http://www.designersandbox.com/tools/500-plus-csshtml-grid-layouts-grid-system/" title="500+ CSS/HTML Grid Layouts (Grid System)">500+ CSS/HTML Grid Layouts (Grid System)</a> (0)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</title>
		<link>http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/</link>
		<comments>http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 15:18:03 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[joomfish]]></category>
		<category><![CDATA[k2]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1683</guid>
		<description><![CDATA[Auto detecting Joomfish languages with your K2 Component, making your attachment number of field to match with JoomFish Component site languages. Please follow the below steps to achieve this. Step 1 /administrator/components/com_k2/tables/k2attachment.php add this in around line 357 var $lang = null; Step 2 /administrator/components/com_k2/model/item.php add this in around line 357, in “save” function $attachments_language_code [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1683"><p><img src="http://www.designersandbox.com/wp-content/uploads/2011/11/k2-joomfish-file-attachment002.png" alt="" title="k2-joomfish-file-attachment002" width="546" height="119" class="alignnone size-full wp-image-1690" /></p>
<p>Auto detecting Joomfish languages with your K2 Component, making your attachment number of field to match with JoomFish Component site languages.<br />
Please follow the below steps to achieve this.</p>
<p><span id="more-1683"></span><br />
<img src="http://www.designersandbox.com/wp-content/uploads/2011/11/k2-joomfish-file-attachment001.png" alt="" title="k2-joomfish-file-attachment001" width="742" height="663" class="alignnone size-full wp-image-1688" /></p>
<div class="steps">
<h3>Step 1</h3>
<p>/administrator/components/com_k2/tables/k2attachment.php add this in around line 357</p>
<pre class="brush: php;">
var $lang = null;
</pre>
</div>
<div class="steps">
<h3>Step 2</h3>
<p>/administrator/components/com_k2/model/item.php add this in around line 357, in “save” function</p>
<pre class="brush: php;">
$attachments_language_code = JRequest::getVar('language_code', '', 'POST', 'array');
</pre>
<hr />
add this in around line 400, in “save” function</p>
<pre class="brush: php;">
$attachments_language_code = JRequest::getVar('language_code', '', 'POST', 'array');
</pre>
</div>
<div class="steps">
<h3>Step 3</h3>
<p>/components/com_k2/models/item.php add this in around line 911, in “getItemAttachments” function</p>
<pre class="brush: php;">
$lang = JRequest::getCmd( 'lang' );
</pre>
<hr />
Original</p>
<pre class="brush: php;">
$query=&quot;SELECT * FROM #__k2_attachments WHERE itemID=&quot;.(int)$itemID;
</pre>
<p>Change it to</p>
<pre class="brush: php;">
$query=&quot;SELECT * FROM #__k2_attachments WHERE itemID=&quot;.(int)$itemID . &quot; and lang = '&quot;.$lang.&quot;'&quot;;
</pre>
</div>
<div class="steps">
<h3>Step 4</h3>
<p>/administrator/components/com_k2/views/item/tmpl/default.php change the javascript function “addAttachment”, replace the old one.</p>
<pre class="brush: php;">
function addAttachment(){
   var div = new Element('div',{'style':'border-top: 1px dotted #ccc; margin: 4px; padding: 10px;'}).injectInside($('itemAttachments'));
   var str = &quot;&quot;;
   str += &quot;&lt;input type=\&quot;button\&quot; value=\&quot;&lt;?php echo JText::_('Remove',true); ?&gt;\&quot; onclick=\&quot;this.getParent().remove();\&quot;&gt;&quot;;
   &lt;?
	$lang =&amp; JFactory::getLanguage();
	$alllangs = $lang-&gt;getKnownLanguages();
	foreach ($alllangs as $key=&gt;$value) {
		list($langcode, $countryCode) = explode(&quot;-&quot;, $key);
   ?&gt;
   var divlang = new Element('div').injectInside(div);
   var input = new Element('input',{'name':'attachment_file[]','type':'file'}).injectInside(divlang);
   var br = new Element('br').injectInside(divlang);
   var label = new Element('label').setHTML('&lt;?php echo JText::_('Link title (optional)', true); ?&gt;').injectInside(divlang);
   var input = new Element('input',{'name':'attachment_title[]','type':'text', 'class':'linkTitle'}).injectInside(divlang);
   var br = new Element('br').injectInside(divlang);
   var label = new Element('label').setHTML('&lt;?php echo JText::_('Link title attribute (optional)', true); ?&gt;').injectInside(divlang);
   var textarea = new Element('textarea',{'name':'attachment_title_attribute[]','cols':'30', 'rows':'3'}).injectInside(divlang);
   var br = new Element('br').injectInside(divlang);
   var languagecode = new Element('input',{'name':'language_code[]','type':'hidden', 'value':'&lt;?=$langcode?&gt;'}).injectInside(divlang);
   str += &quot;&lt;div&gt;&quot;;
   str += &quot;&lt;div style=\&quot;float:left; width:150px; font-weight:bold;\&quot;&gt;&lt;?=$value[&quot;name&quot;]?&gt;&lt;/div&gt;&quot;;
   str += &quot;&lt;div style=\&quot;float:left;\&quot;&gt;&quot; +  divlang.innerHTML + &quot;&lt;/div&gt;&lt;div style=\&quot;clear:both;\&quot;&gt;&lt;/div&gt;&quot;;
   str += &quot;&lt;/div&gt;&quot;;
&lt;?
	}
?&gt;
 div.innerHTML = str;

   }
</pre>
</div>
<div class="steps">
<h3>Step 5 &#8211; Database</h3>
<p>enter this in your sql server (you will need phpmyadmin for this)</p>
<pre class="brush: php;">
ALTER TABLE `jos_k2_attachments` ADD `lang` VARCHAR( 10 ) NULL
</pre>
</div>
<div class="message">
<h3>Step 6 &#8211; Need Help?</h3>
<p>We do accept freelance customization to K2 and Joomfish development.<br />
The freelance price for customization is USD50/hr*<br />
*Minimum charge will be USD100<br />
Interested Party please email us at info[a]designersandbox[dot]com
</p></div>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1683&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-pagination-mod-hacks/" title="Joomla Virtuemart &#8211; Pagination Mod.(Hacks)">Joomla Virtuemart &#8211; Pagination Mod.(Hacks)</a> (5)</li><li><a href="http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/" title="Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad">Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad</a> (4)</li><li><a href="http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/" title="How to embed YouTube Video within the Facebook fbml tabs">How to embed YouTube Video within the Facebook fbml tabs</a> (6)</li><li><a href="http://www.designersandbox.com/wordpress/wordpress-restricting-personal-ips-on-all-in-one-adsense-and-ypn/" title="Wordpress &#8211; Restricting Personal IPs on All in One Adsense and YPN!">Wordpress &#8211; Restricting Personal IPs on All in One Adsense and YPN!</a> (1)</li><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-call-for-price/" title="Joomla Virtuemart Call for Pricing change to show both Inquiry and Login">Joomla Virtuemart Call for Pricing change to show both Inquiry and Login</a> (4)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</title>
		<link>http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/</link>
		<comments>http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 08:55:19 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Inspirational]]></category>
		<category><![CDATA[Sharing]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1532</guid>
		<description><![CDATA[With the flexibility of CSS3 / html5 / JavaScript, we see new approach to web design. With more power css3 / html5 / javascript, designer and developer can now do things in a more fancy way (design fashion). While scrolling the page down, you can see the interaction that the designer or brand that showcase [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1532"><p>With the flexibility of CSS3 / html5 / JavaScript, we see new approach to web design. With more power css3 / html5 / javascript, designer and developer can now do things in a more fancy way (design fashion). While scrolling the page down, you can see the interaction that the designer or brand that showcase there product in a way few years ago only Flash can handle. But now with the power of CSS3 and HTML5, we can put in details into the whole structure and flow of the web in a simple way. Now you are viewing not just an website, you are now viewing a webshow! Now, let&#8217;s the show begin.</p>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2011/11/360langstrassezurich.jpeg" alt="" title="360langstrassezurich" width="701" height="391" class="alignnone size-full wp-image-1533" /><br />
<span id="more-1532"></span><br />
<a href="http://www.360langstrasse.sf.tv/">http://www.360langstrasse.sf.tv/</a></p>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2011/11/beetle.jpeg" alt="" title="beetle" width="701" height="391" class="alignnone size-full wp-image-1535" /><br />
<a href="http://www.beetle.com">http://www.beetle.com</a></p>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2011/11/hyundaiveloster.jpeg" alt="" title="hyundaiveloster" width="701" height="391" class="alignnone size-full wp-image-1536" /><br />
<a href="http://www.hyundai-veloster.eu">http://www.hyundai-veloster.eu</a></p>
<h2>Tutorials on scrolling animation:</h2>
<h3>Parallax Scrolling Background</h3>
<p>In this tutorial, we’ll be using JQuery to take a horizontally scrolling website and add a parallax scrolling background effect reminiscent of old-school 2D platform games like Sonic the Hedgehog.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2011/11/create-a-funky-parallax-background-effect-using-jquery.jpeg" alt="" title="create-a-funky-parallax-background-effect-using-jquery" width="500" height="227" class="alignnone size-full wp-image-1538" /><br />
Demo: <a href="http://themeforest.s3.amazonaws.com/116_parallax/tutorial-source-files/tut-index.html">http://themeforest.s3.amazonaws.com/116_parallax/tutorial-source-files/tut-index.html</a><br />
Tutorial: <a href="http://blog.themeforest.net/tutorials/create-a-funky-parallax-background-effect-using-jquery/">http://blog.themeforest.net/tutorials/create-a-funky-parallax-background-effect-using-jquery/</a></p>
<hr />
<h3>Make Your Header Responses to Mouse Movements</h3>
<p>In this jQuery animation technique, you will learn how to animate a set of images that reacts to the user’s mouse movements. When the user hovers over a set of images, the set begins to follow the mouse cursor. This technique can be adapted to many user interface related functions, or you can just use it to impart a memorable experience to your users.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2011/11/make-your-header-responses-to-mouse-movements-with-jparallax.jpeg" alt="" title="make-your-header-responses-to-mouse-movements-with-jparallax" width="500" height="350" class="alignnone size-full wp-image-1543" /><br />
<a href="http://oopit.wordpress.com/2009/10/27/make-your-header-responses-to-mouse-movements-with-jparallax/">http://oopit.wordpress.com/2009/10/27/make-your-header-responses-to-mouse-movements-with-jparallax/</a></p>
<hr />
<h3>Animate Curtains Opening with jQuery</h3>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2011/11/curtain.jpeg" alt="" title="curtain" width="600" height="160" class="alignnone size-full wp-image-1545" /><br />
Demo: <a href="http://buildinternet.com/live/curtains/">http://buildinternet.com/live/curtains/</a><br />
Tutorials: <a href="http://buildinternet.com/2009/07/animate-curtains-opening-with-jquery/">http://buildinternet.com/2009/07/animate-curtains-opening-with-jquery/</a></p>
<h2>Resource jQuery</h2>
<h3>Scrolling Parallax: A jQuery Plugin</h3>
<p>Scrolling Parallax is a new jQuery plugin that binds a parallax effect to the scrollbars and mouse wheel. This allows a background image or anything else to scroll at a different pace than the web page when a user scrolls around. The parallax effect that results is an easy way to create an illusion of depth on your website.<br />
<a href="http://jonraasch.com/blog/scrolling-parallax-jquery-plugin">http://jonraasch.com/blog/scrolling-parallax-jquery-plugin</a></p>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1532&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/code/how-to-make-a-proper-css-button/" title="How to make a proper CSS button">How to make a proper CSS button</a> (1)</li><li><a href="http://www.designersandbox.com/sharing/22-css-jquery-solutions-showcase-tutorials-beautify-your-website-now/" title="22 CSS/jQuery Solutions Showcase Tutorials, Beautify Your WebSite Now">22 CSS/jQuery Solutions Showcase Tutorials, Beautify Your WebSite Now</a> (4)</li><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li><li><a href="http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/" title="How to embed YouTube Video within the Facebook fbml tabs">How to embed YouTube Video within the Facebook fbml tabs</a> (6)</li><li><a href="http://www.designersandbox.com/inspirational/the-new-era-of-fluid-web-layout-with-smartcolumn-and-spacemaker/" title="The New Era Of Fluid Web Layout With SmartColumn And SpaceMaker">The New Era Of Fluid Web Layout With SmartColumn And SpaceMaker</a> (5)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad</title>
		<link>http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/</link>
		<comments>http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 04:35:47 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Unity3D]]></category>
		<category><![CDATA[iOS Dev]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1523</guid>
		<description><![CDATA[OnMouseDown/OnMouseUp() are disabled in iPhone Unity for performance reasons. You can use following JS/C# code to find GUI element under the touch: JavaScript // GUITouchController.js // A script to allow MouseUp and MouseDown on the iPhone var detectOnMouseOver : boolean = false; var wasMouseDownInPrevFrame : boolean = false; var wasMouseOverInPrevFrame : boolean = false; var [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1523"><p>OnMouseDown/OnMouseUp() are disabled in iPhone Unity for performance reasons.</p>
<p>You can use following JS/C# code to find GUI element under the touch:<br />
<span id="more-1523"></span></p>
<h4>JavaScript</h4>
<pre class="brush: jscript;">
//	GUITouchController.js
//	A script to allow MouseUp and MouseDown on the iPhone

var detectOnMouseOver : boolean = false;
var wasMouseDownInPrevFrame : boolean = false;
var wasMouseOverInPrevFrame : boolean = false;

var prevFrameElement : GUIElement;

function FindGUIElement (camera : Camera, mousePosition : Vector3) : GUIElement {

	// Is the mouse inside the cameras viewport?
	var rect : Rect = camera.pixelRect;

	if (!rect.Contains (mousePosition))
		return null;

	// Did we hit any gui elements?
	var layer : GUILayer = camera.GetComponent (GUILayer);
	if (!layer)
		return null;

	return layer.HitTest (mousePosition);
}

// Use this for initialization
//function Start () {
//
//}

// Update is called once per frame
function Update () {
	if(detectOnMouseOver){
		var element : GUIElement = FindGUIElement( Camera.main, Input.mousePosition);

		if (element){
			if (!wasMouseOverInPrevFrame){
				wasMouseOverInPrevFrame = true;
				element.SendMessage(&quot;OnMouseOver&quot;,null,SendMessageOptions.DontRequireReceiver);
			}

		if (Input.GetMouseButtonDown(0)){
			if(!wasMouseDownInPrevFrame){
				wasMouseDownInPrevFrame = true;
				element.SendMessage(&quot;OnMouseDown&quot;,null,SendMessageOptions.DontRequireReceiver);
			}

		}else if(wasMouseDownInPrevFrame){
			if (!Input.GetMouseButton(0)){
				element.SendMessage(&quot;OnMouseUp&quot;,null,SendMessageOptions.DontRequireReceiver);
				wasMouseDownInPrevFrame = false;
			}
		}

		prevFrameElement = element;

	}else if (wasMouseOverInPrevFrame){
		prevFrameElement.SendMessage(&quot;OnMouseExit&quot;,null,SendMessageOptions.DontRequireReceiver);
		wasMouseOverInPrevFrame = false;
	}

	}
	else {
			//only detect OnMouseDown and OnMouseUp, not also OnMouseOver and OnMouseExit to save performance (by only looking for gui elements when mouse button is pressed)
		if (Input.GetMouseButtonDown(0)){
			element = FindGUIElement( Camera.main, Input.mousePosition);
			if (element){
				if(!wasMouseDownInPrevFrame){
					wasMouseDownInPrevFrame = true;
					element.SendMessage(&quot;OnMouseDown&quot;,null,SendMessageOptions.DontRequireReceiver);
				prevFrameElement = element;
				}
			}
		}
		else if(wasMouseDownInPrevFrame){
			if (!Input.GetMouseButton(0)){
				prevFrameElement.SendMessage(&quot;OnMouseUp&quot;,null,SendMessageOptions.DontRequireReceiver);
				wasMouseDownInPrevFrame = false;
			}
		}
	}
}
</pre>
<h4>C# Code</h4>
<pre class="brush: cpp;">
using UnityEngine;
using System.Collections; 

//todo: iterate throw multiple prevFrame items in array
//todo: check if pref frame items still exist
//todo: add optional constant check option

public class GUITouchController : MonoBehaviour { 

    public bool detectOnMouseOver = false;
    private bool wasMouseDownInPrevFrame = false;
    private bool wasMouseOverInPrevFrame = false;
    private GUIElement prevFrameElement;

    GUIElement FindGUIElement(Camera camera, Vector3 mousePosition){
   // Is the mouse inside the cameras viewport?
   Rect rect = camera.pixelRect;
   if (!rect.Contains (mousePosition))
      return null; 

   // Did we hit any gui elements?
   GUILayer layer = (GUILayer)camera.GetComponent (typeof (GUILayer));
   if (!layer)
      return null; 

   return layer.HitTest (mousePosition);
    } 

   // Use this for initialization
   void Start () { 

   } 

    // Update is called once per frame
	void Update () {
		if(detectOnMouseOver){
			GUIElement element = FindGUIElement( Camera.main, Input.mousePosition);
			if (element){
				if (!wasMouseOverInPrevFrame){
					wasMouseOverInPrevFrame = true;
					element.SendMessage(&quot;OnMouseOver&quot;,null,SendMessageOptions.DontRequireReceiver);
				}
				if (Input.GetMouseButtonDown(0)){
					if(!wasMouseDownInPrevFrame){
						wasMouseDownInPrevFrame = true;
						element.SendMessage(&quot;OnMouseDown&quot;,null,SendMessageOptions.DontRequireReceiver);
					}
				}else if(wasMouseDownInPrevFrame){
					if (!Input.GetMouseButton(0)){
						element.SendMessage(&quot;OnMouseUp&quot;,null,SendMessageOptions.DontRequireReceiver);
						wasMouseDownInPrevFrame = false;
					}
				}
				prevFrameElement = element;
			}else if (wasMouseOverInPrevFrame){
				prevFrameElement.SendMessage(&quot;OnMouseExit&quot;,null,SendMessageOptions.DontRequireReceiver);
				wasMouseOverInPrevFrame = false;
			} 

		}else{
   			//only detect OnMouseDown and OnMouseUp, not also OnMouseOver and OnMouseExit to save performance (by only looking for gui elements when mouse button is pressed)
			if (Input.GetMouseButtonDown(0)){
				GUIElement element = FindGUIElement( Camera.main, Input.mousePosition);
				if (element){
					if(!wasMouseDownInPrevFrame){
						wasMouseDownInPrevFrame = true;
						element.SendMessage(&quot;OnMouseDown&quot;,null,SendMessageOptions.DontRequireReceiver);
						prevFrameElement = element;
					}
				}
			}else if(wasMouseDownInPrevFrame){
				if (!Input.GetMouseButton(0)){
					prevFrameElement.SendMessage(&quot;OnMouseUp&quot;,null,SendMessageOptions.DontRequireReceiver);
					wasMouseDownInPrevFrame = false;
				}
			}
   		}
   	}

}
</pre>
<p>original post from here</p>
<p>http://forum.unity3d.com/threads/15377-quot-OnMouseDown()-quot-or-quot-OnMouseUp-quot-On-GUIT</p>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1523&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/" title="Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack">Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</a> (1)</li><li><a href="http://www.designersandbox.com/ios-dev/process-for-developing-on-multiple-computers-for-your-iphone-ipad-ipod-touch-mac-os/" title="Process for developing on multiple computers for your iPhone, iPad, iPod touch, Mac OS">Process for developing on multiple computers for your iPhone, iPad, iPod touch, Mac OS</a> (6)</li><li><a href="http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/" title="How to embed YouTube Video within the Facebook fbml tabs">How to embed YouTube Video within the Facebook fbml tabs</a> (6)</li><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li><li><a href="http://www.designersandbox.com/tools/tools-and-tips-for-everyday-web-designing-web-resolution-and-size/" title="Tools and Tips for everyday web designing &#8211; Web Resolution and Size">Tools and Tips for everyday web designing &#8211; Web Resolution and Size</a> (2)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to make a proper CSS button</title>
		<link>http://www.designersandbox.com/code/how-to-make-a-proper-css-button/</link>
		<comments>http://www.designersandbox.com/code/how-to-make-a-proper-css-button/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 08:43:45 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Sharing]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1403</guid>
		<description><![CDATA[This post will teach you how to make a proper CSS button. &#60;a class=&#34;button btn_file btn_blue&#34;&#62; &#60;span&#62; &#60;span&#62;Button Text&#60;/span&#62; &#60;/span&#62; &#60;/a&#62; From the above code you can see that I had entered 3 classes for the < a > tag, they are button, btn_file and btn_blue. This is how I usually construct the class layer. [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1403"><p><img src="http://www.designersandbox.com/wp-content/uploads/2010/11/button_cover.jpg" alt="" title="button_cover" width="500" height="497" class="alignnone size-full wp-image-1407" /><br />
This post will teach you how to make a proper CSS button. </p>
<pre class="brush: xml;">
&lt;a class=&quot;button btn_file btn_blue&quot;&gt;
     &lt;span&gt;
          &lt;span&gt;Button Text&lt;/span&gt;
     &lt;/span&gt;
&lt;/a&gt;
</pre>
<p>From the above code you can see that I had entered 3 classes for the < a > tag, they are button, btn_file and btn_blue. This is how I usually construct the class layer.<br />
<span id="more-1403"></span></p>
<ul>
<li>class=&#8221;button&#8221; this control the default button layout</li>
<li>class=&#8221;btn_file&#8221; this class display which icon to show</li>
<li>class=&#8221;btn_blue&#8221; if you have a different set of color setting or other layout for the button, this is the class to overwrite your default class. This can also be use as additional setting for your button</li>
</ul>
<p>So I had draft out a layer of the a tag and span tag which are used for this button.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2010/11/button_001.jpg" alt="" title="button_001" width="500" height="497" class="alignnone size-full wp-image-1409" /></p>
<p>More details on how we construct the button.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2010/11/button_draft.jpg" alt="" title="button_draft" width="500" height="373" class="alignnone size-full wp-image-1410" /></p>
<p>This is the final result that I draft out on paper.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2010/11/button_final.jpg" alt="" title="button_final" width="500" height="358" class="alignnone size-full wp-image-1411" /></p>
<pre class="brush: css;">
a.button {
     float:left;
     margin: 20px 30px 10px 0;
     color: #333333;
     border: 1px solid #CCCCCC;
     background: url(&quot;YOUR_IMAGE_FILE.png&quot;) repeat-x center bottom;
     display: block;
     white-space: nowrap;
     text-decoration: none;
}

a.btn_file span{
     background-image: url(&quot;YOUR_IMAGE_FILE.png&quot;);
     background-position: 10px 7px;
     background-repeat: no-repeat;
     border: 1px solid #FFFFFF;
     display: block;
     padding: 0 15px 0 33px;
}

a.button span span{
     background: none;
     border: none;
     display: inline;
     height: auto;
     line-height: 28px;
     padding: 0;
}
</pre>
<div class="steps">
<h3>Watch it in action</h3>
<p><a class="button btn_file btn_blue"><span><span>Button Text</span></span></a></p>
<hr />
</div>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1403&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li><li><a href="http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/" title="How to embed YouTube Video within the Facebook fbml tabs">How to embed YouTube Video within the Facebook fbml tabs</a> (6)</li><li><a href="http://www.designersandbox.com/announcement/designersandbox-roadmap-on-post-it/" title="DesignerSandbox Roadmap on post-it">DesignerSandbox Roadmap on post-it</a> (3)</li><li><a href="http://www.designersandbox.com/code/always-bottom-footer-with-css-only-tutorials/" title="Always bottom footer with CSS only &#8211; Tutorials">Always bottom footer with CSS only &#8211; Tutorials</a> (8)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/how-to-make-a-proper-css-button/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to embed YouTube Video within the Facebook fbml tabs</title>
		<link>http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/</link>
		<comments>http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 12:00:04 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1392</guid>
		<description><![CDATA[This is a how-to article on expanding your Facebook Fan Page (aka Business Page) by using the application Static FBML which allows you to add youtube video to your tabs or box which can incorporate CSS, HTML, Facebook&#8217;s flavor of JavaScript, FBJS, and Facebook&#8217;s mark-up language FBML. FBML has greatly expanded what is possible on [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1392"><p><img src="http://www.designersandbox.com/wp-content/uploads/2010/11/fbml_youtube.png" alt="" title="fbml_youtube" width="500" height="282" class="alignnone size-full wp-image-1393" /></p>
<p>This is a how-to article on expanding your Facebook Fan Page (aka Business Page) by using the application Static FBML  which allows you to add youtube video to your tabs or box which can incorporate CSS, HTML, Facebook&#8217;s flavor of JavaScript, FBJS, and Facebook&#8217;s mark-up language FBML. FBML has greatly expanded what is possible on Facebook Pages and, if you&#8217;re sufficiently skilled with CSS/HTML and, optionally, FBML, you can make some really fine looking Pages. Basically this not an actual youtube embed that you normally do, you will need to follow the below code to make this work in Facebook. Simply Facebook will first show the image that we have within the code below, and then upon user confirm with a click then play and load the video.<br />
<span id="more-1392"></span></p>
<div class="steps">
<h3>fb:swf code for your Youtube video</h3>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2010/11/fbml_youtube_code.png" alt="" title="fbml_youtube_code" width="500" height="282" class="alignnone size-full wp-image-1394" /></p>
<pre class="brush: xml;">
&lt;fb:swf swfbgcolor=&quot;000000&quot; imgstyle=&quot;border-width:3px; border-color:white;&quot; swfsrc='http://www.youtube.com/v/YOUR_VIDEO_ID?fs=1&amp;hl=en_US&amp;rel=0&amp;autoplay=1' imgsrc='http://YOUR_IMAGE_LINK?ver1.0' width='520' height='322' /&gt;
</pre>
<p>Depend on the design of your fbml page, you can also tweak the image size as well.<br />
Here&#8217;s some sample of it.<br />
<img src="http://www.designersandbox.com/wp-content/uploads/2010/11/fbml_youtube_image_sample2.png" alt="" title="fbml_youtube_image_sample2" width="500" height="558" class="alignnone size-full wp-image-1398" /><br />
<a href="http://www.facebook.com/npxwaterwear?v=app_4949752878">Watch it in action!</a></p>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2010/11/fbml_youtube_image_sample.png" alt="" title="fbml_youtube_image_sample" width="500" height="600" class="alignnone size-full wp-image-1399" /><br />
<a href="http://www.facebook.com/#!/Levis?v=app_110665725655672">Watch it in action!</a>
</div>
<div class="steps">
<h3>Extra Notes: Facebook Cache every images in there static FMBL app</h3>
<p><img src="http://www.designersandbox.com/wp-content/uploads/2010/11/fbml_youtube_image_version.png" alt="" title="fbml_youtube_image_version" width="500" height="282" class="alignnone size-full wp-image-1395" /></p>
<p>Also Facebook will cache every image that you push to there site. If you would like to update your image on the static FBML tabs, you will need to put a version at the end of your image link like ?ver1.0 . This will give the page to reload the image. If you have another update, just name it ver1.1.
</p></div>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1392&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/" title="Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack">Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</a> (1)</li><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li><li><a href="http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/" title="Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad">Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad</a> (4)</li><li><a href="http://www.designersandbox.com/magento/installing-magento-version-1-4-2-0-on-icdsoft/" title="Installing Magento [version 1.4.2.0] on ICDSoft">Installing Magento [version 1.4.2.0] on ICDSoft</a> (4)</li><li><a href="http://www.designersandbox.com/code/how-to-make-a-proper-css-button/" title="How to make a proper CSS button">How to make a proper CSS button</a> (1)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/how-to-embed-youtube-video-within-the-facebook-fbml-tabs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flash loading external video link in loops for AS2</title>
		<link>http://www.designersandbox.com/code/flash-loading-external-video-link-in-loops-for-as2/</link>
		<comments>http://www.designersandbox.com/code/flash-loading-external-video-link-in-loops-for-as2/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 07:42:34 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Sharing]]></category>
		<category><![CDATA[actionscript 2.0]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1294</guid>
		<description><![CDATA[Today a client would like to create a flash banner that load external flv file and keep the video in loop. Never ending playback. This is a more or less a beginner scripts for flash. There&#8217;s much we can do for this, if anyone is more interested on this kinda topics drop me a reply [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1294"><p><img src="http://www.designersandbox.com/wp-content/uploads/2010/10/tuts01.png" alt="" title="tuts01" width="500" height="300" class="alignnone size-full wp-image-1297" /></p>
<p>Today a client would like to create a flash banner that load external flv file and keep the video in loop. Never ending playback. This is a more or less a beginner scripts for flash. There&#8217;s much we can do for this, if anyone is more interested on this kinda topics drop me a reply I will write more about this topic.<br />
<span id="more-1294"></span><br />
First on the first key frame open your action panel or press F9</p>
<pre class="brush: jscript;">
var url = &quot;http://ENTER YOUR URL HERE&quot;;
var nc: NetConnection = new NetConnection();
nc.connect(null);
var ns: NetStream = new NetStream(nc);
ns.setBufferTime(5);

ns.onStatus = function(info){
	if(info.code == &quot;NetStream.Buffer.Full&quot;){
	}
	if(info.code == &quot;NetStream.Buffer.Empty&quot;){
	}
	if(info.code == &quot;NetStream.Play.Stop&quot;){
		ns.seek(0);
		ns.play(url);
	}
}

//video location
myVideo.attachVideo(ns);
ns.play(url);
</pre>
<p>This is the code you will need to put in your timeline.<br />
Simply change the <code>var url = "http://ENTER YOUR URL HERE";</code><br />
Replace this with your own flv.</p>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1294&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li><li><a href="http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/" title="Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack">Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</a> (1)</li><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li><li><a href="http://www.designersandbox.com/code/unity3d-onmousedown-onmouseup-on-guit-for-iphone-and-ipad/" title="Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad">Unity3D OnMouseDown() OnMouseUp on GUIT for iPhone and iPad</a> (4)</li><li><a href="http://www.designersandbox.com/code/how-to-make-a-proper-css-button/" title="How to make a proper CSS button">How to make a proper CSS button</a> (1)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/flash-loading-external-video-link-in-loops-for-as2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento &#8211; Adding external product link for all your products</title>
		<link>http://www.designersandbox.com/code/magento-adding-custom-product-link-for-all-your-products/</link>
		<comments>http://www.designersandbox.com/code/magento-adding-custom-product-link-for-all-your-products/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 06:32:45 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[attribute set]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1267</guid>
		<description><![CDATA[This tutorial is all about add an external link, either it is a Amazon product link, demo link, or any external link. This script is what you need for your magento. Within this page, you will find the step by step screenshot of creating your own attribute/set, and calling those attribute from your own template. [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1267"><p><img class="alignnone size-full wp-image-1268" title="external_product_link" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link.png" alt="" width="470" height="64" /></p>
<p>This tutorial is all about add an external link, either it is a Amazon product link, demo link, or any external link. This script is what you need for your magento. Within this page, you will find the step by step screenshot of creating your own attribute/set, and calling those attribute from your own template.</p>
<p>First you will need to create all the attribute / attribute set for your products. Below is an example of creating an external product links.</p>
<p>Here&#8217;s something I had created for my template selling site.<span id="more-1267"></span></p>
<p><img class="alignnone size-full wp-image-1271" title="external_product_link_001" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_001.png" alt="" width="500" height="377" /></p>
<p>First select the Attribute from the menu, and click on Manage Attributes</p>
<p><img title="external_product_link_menu" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_menu.png" alt="" width="340" height="325" /></p>
<p>Click the Add New icon to create your Attribute. <img title="external_product_link_addnew" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_addnew.png" alt="" width="95" height="25" /></p>
<p><img class="alignnone size-full wp-image-1272" title="external_product_link_002" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_002.png" alt="" width="500" height="352" /></p>
<p>Now Save the attribute you had just created.<img title="external_product_link_save" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_save.png" alt="" width="128" height="30" /></p>
<p>Click the Add New icon to create your Attribute. <img title="external_product_link_addnew" src="../wp-content/uploads/2010/10/external_product_link_addnew.png" alt="" width="95" height="25" /></p>
<p><img class="alignnone size-full wp-image-1273" title="external_product_link_003" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_003.png" alt="" width="500" height="890" /></p>
<p>Now Save the attribute you had just created.<img title="external_product_link_save" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_save.png" alt="" width="128" height="30" /></p>
<p>Click the Add New icon to create your Attribute. <img title="external_product_link_addnew" src="../wp-content/uploads/2010/10/external_product_link_addnew.png" alt="" width="95" height="25" /></p>
<p><img class="alignnone size-full wp-image-1274" title="external_product_link_004" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_004.png" alt="" width="500" height="835" /><br />
Click on the Side tab &#8220;Manage Label/Options&#8221;<br />
<img class="alignnone size-full wp-image-1282" title="external_product_link_b" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_b.png" alt="" width="228" height="106" /></p>
<p>Then type the following.<br />
<img class="alignnone size-full wp-image-1289" title="external_product_link_011" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_011.png" alt="" width="500" height="299" /></p>
<p>Now Save the attribute you had just created.<img title="external_product_link_save" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_save.png" alt="" width="128" height="30" /></p>
<p>Click the Add New icon to create your Attribute. <img title="external_product_link_addnew" src="../wp-content/uploads/2010/10/external_product_link_addnew.png" alt="" width="95" height="25" /></p>
<p><img class="alignnone size-full wp-image-1275" title="external_product_link_005" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_005.png" alt="" width="500" height="885" /></p>
<p>Now Save the attribute you had just created.<img title="external_product_link_save" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_save.png" alt="" width="128" height="30" /></p>
<p>Click the Add New icon to create your Attribute. <img title="external_product_link_addnew" src="../wp-content/uploads/2010/10/external_product_link_addnew.png" alt="" width="95" height="25" /></p>
<p><img class="alignnone size-full wp-image-1276" title="external_product_link_006" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_006.png" alt="" width="499" height="888" /></p>
<p>Now Save the attribute you had just created.<img title="external_product_link_save" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_save.png" alt="" width="128" height="30" /></p>
<p><img title="external_product_link_menuset" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_menuset.png" alt="" width="340" height="325" /></p>
<p>Click on the Add New Set</p>
<p><img class="alignnone size-full wp-image-1277" title="external_product_link_007" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_007.png" alt="" width="500" height="300" /></p>
<p>Here&#8217;s the product set that we had created &#8220;Product External Link&#8221;<br />
<img class="alignnone size-full wp-image-1278" title="external_product_link_008" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_008.png" alt="" width="343" height="358" /></p>
<p>Drag and drop the Attributes you just created and drop it into the Product External Link</p>
<p><img class="alignnone size-full wp-image-1279" title="external_product_link_009" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_009.png" alt="" width="200" height="184" /></p>
<p>Like the below image</p>
<p><img class="alignnone size-full wp-image-1280" title="external_product_link_010" src="http://www.designersandbox.com/wp-content/uploads/2010/10/external_product_link_010.png" alt="" width="329" height="502" /></p>
<p>Now save, and open your code and tweak the the following</p>
<p>Please open list.phtml and view.phtml. This file should be located at your template folder<br />
app/design/frontend/default/[YOUR_THEME]/template/catalog/product/list.phtml<br />
app/design/frontend/default/[YOUR_THEME]/template/catalog/product/view.phtml<br />
Your button phtml may look a bit different, the idea is to get find this similar code and make a tiny tweak to it.</p>
<pre class="brush: php;">
&lt;?php if($_product-&gt;isSaleable()): ?&gt;
	&lt;p&gt;&lt;button type=&quot;button&quot; title=&quot;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&quot; class=&quot;button btn-cart&quot; onclick=&quot;setLocation('&lt;?php echo $this-&gt;getAddToCartUrl($_product) ?&gt;')&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
&lt;?php else: ?&gt;
	&lt;p class=&quot;availability out-of-stock&quot;&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/span&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre>
<p>Put the following code above your button code.</p>
<pre class="brush: php;">
&lt;?php
    $_productForExternalLink = Mage::getModel('catalog/product')-&gt;load($_product-&gt;getId());
    if (1 == $_productForExternalLink-&gt;getData('product_external_link')) {
        $linkTargetAttributeObj = $_productForExternalLink-&gt;getResource()-&gt;getAttribute(&quot;product_external_link_target&quot;);
        if ($linkTargetAttributeObj-&gt;usesSource()) {
            $link_target = $linkTargetAttributeObj-&gt;getSource()-&gt;getOptionText($_productForExternalLink-&gt;getData('product_external_link_target'));
        }
?&gt;

    &lt;div class=&quot;product_external_link&quot;&gt;
        &lt;a href=&quot;&lt;?php echo $_productForExternalLink-&gt;getData('product_external_link_url'); ?&gt;&quot; target=&quot;&lt;?php echo $link_target; ?&gt;&quot; style=&quot;background:url('&lt;?php echo $_productForExternalLink-&gt;getData('product_external_link_image'); ?&gt;') repeat-x; display:inline-block; margin:0 3px 8px;&quot;&gt;
            &lt;span&gt;&lt;?php echo $_productForExternalLink-&gt;getData('product_external_link_text'); ?&gt;&lt;/span&gt;
        &lt;/a&gt;
    &lt;/div&gt;

&lt;?php
    } else {
?&gt;

	&lt;?php if($_product-&gt;isSaleable()): ?&gt;
        &lt;p&gt;&lt;button type=&quot;button&quot; title=&quot;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&quot; class=&quot;button btn-cart&quot; onclick=&quot;setLocation('&lt;?php echo $this-&gt;getAddToCartUrl($_product) ?&gt;')&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
    &lt;?php else: ?&gt;
        &lt;p class=&quot;availability out-of-stock&quot;&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/span&gt;&lt;/p&gt;
    &lt;?php endif; ?&gt;
&lt;?php
    }
?&gt;
</pre>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1267&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/magento/magento-fix-for-google-analytics-not-tracking-not-receiving-data/" title="Magento Fix for Google Analytics &#8211; Not Tracking &#8211; Not Receiving Data">Magento Fix for Google Analytics &#8211; Not Tracking &#8211; Not Receiving Data</a> (4)</li><li><a href="http://www.designersandbox.com/magento/ds-mobishop-our-first-magento-theme-landed-on-themeforest/" title="DS MobiShop &#8211; Our first magento theme landed on Themeforest">DS MobiShop &#8211; Our first magento theme landed on Themeforest</a> (0)</li><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li><li><a href="http://www.designersandbox.com/joomla/adding-multiple-attachment-for-joomla-k2-component-according-to-the-number-of-joomfishs-language/" title="Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack">Adding Multiple Attachment for Joomla K2 Component according to the number of JoomFish&#8217;s language hack</a> (1)</li><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/magento-adding-custom-product-link-for-all-your-products/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Joomla Virtuemart Call for Pricing change to show both Inquiry and Login</title>
		<link>http://www.designersandbox.com/joomla/joomla-virtuemart-call-for-price/</link>
		<comments>http://www.designersandbox.com/joomla/joomla-virtuemart-call-for-price/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 08:42:46 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[virtuemart]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=1258</guid>
		<description><![CDATA[My client would like to enable his consumers to view the prices upon login, and also be able to send inquiries to him directly from the product page. Since Virtuemart only allow you to &#8220;Call for Pricing&#8221; redirect to an product inquiry form, this lacks of user friendliness upon user. So I would like to [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-1258"><p><a href="http://www.designersandbox.com/wp-content/uploads/2010/09/joomla_virtuemart.jpg"><img src="http://www.designersandbox.com/wp-content/uploads/2010/09/joomla_virtuemart.jpg" alt="Joomla Virtuemart Call for Pricing change to show both Inquiry and Login" title="joomla_virtuemart" width="590" height="300" class="alignnone size-full wp-image-1259" /></a><br />
My client would like to enable his consumers to view the prices upon login, and also be able to send inquiries to him directly from the product page. Since Virtuemart only allow you to &#8220;Call for Pricing&#8221; redirect to an product inquiry form, this lacks of user friendliness upon user. So I would like to add a login link right next to &#8220;Call for pricing&#8221;. I would also like to rename the &#8220;Call for pricing&#8221; to Inquiry. It should look something like the above image.<br />
<span id="more-1258"></span><br />
Here&#8217;s how you accomplished this.<br />
2 files you will need to alter to get this done.</p>
<ol>
<li>price.tpl.php &#8211; Located at your joomla root folder <br />\components\com_virtuemart\themes\ja-zeolite\templates\common\price.tpl.php</li>
<li>english.php &#8211; Located at your joomla administrator folder <br />\administrator\components\com_virtuemart\languages\common\english.php</li>
</ol>
<p>Open your english.php file.<br />
locate this code</p>
<pre class="brush: php;">'PHPSHOP_PRODUCT_CALL' =&gt; 'Call for Pricing',</pre>
<p>and change to this></p>
<pre class="brush: php;">
'PHPSHOP_PRODUCT_CALL' =&gt; 'Product Inquiry',
'PHPSHOP_PRODUCT_LOGIN' =&gt; 'Login for Pricing',
</pre>
<p>Open your price.tpl.php file and make the following changes<br />
locate this code</p>
<pre class="brush: php;">
$link = $sess-&gt;url( $_SERVER['PHP_SELF'].'?page=shop.ask&amp;amp;product_id='.$product_id.'&amp;amp;subject='. urlencode( $VM_LANG-&gt;_('PHPSHOP_PRODUCT_CALL').&quot;: $product_name&quot;) );
	echo vmCommonHTML::hyperLink( $link, $VM_LANG-&gt;_('PHPSHOP_PRODUCT_CALL') );
</pre>
<p>below this code add the following></p>
<pre class="brush: php;">
	echo &quot; | &quot;;
	$link =$_SERVER['PHP_SELF'] . '?option=com_user&amp;amp;view=login&amp;amp;product_id='.$product_id;
	echo vmCommonHTML::hyperLink( $link, $VM_LANG-&gt;_('PHPSHOP_PRODUCT_LOGIN') );
</pre>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=1258&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-ultimate-dynamic-images-hack-for-categories-images/" title="Joomla Virtuemart – Ultimate Dynamic Images Hack for Categories Images">Joomla Virtuemart – Ultimate Dynamic Images Hack for Categories Images</a> (22)</li><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-disable-the-session-cache-on-get_discount-hack/" title="Joomla Virtuemart &#8211; Disable The Session Cache on get_discount Hack">Joomla Virtuemart &#8211; Disable The Session Cache on get_discount Hack</a> (7)</li><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-auto-resize-full-product-image-dynamically-mod-hacks/" title="Joomla Virtuemart – Full Product Image Auto Resize Dynamically – Mod.(Hacks)">Joomla Virtuemart – Full Product Image Auto Resize Dynamically – Mod.(Hacks)</a> (10)</li><li><a href="http://www.designersandbox.com/joomla/joomla-virtuemart-pagination-mod-hacks/" title="Joomla Virtuemart &#8211; Pagination Mod.(Hacks)">Joomla Virtuemart &#8211; Pagination Mod.(Hacks)</a> (5)</li><li><a href="http://www.designersandbox.com/joomla/virtuemart-product-categories-module-hack-extra-span-please/" title="Virtuemart Product Categories Module Hack (extra span PLEASE!)">Virtuemart Product Categories Module Hack (extra span PLEASE!)</a> (3)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/joomla/joomla-virtuemart-call-for-price/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Always bottom footer with CSS only &#8211; Tutorials</title>
		<link>http://www.designersandbox.com/code/always-bottom-footer-with-css-only-tutorials/</link>
		<comments>http://www.designersandbox.com/code/always-bottom-footer-with-css-only-tutorials/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 10:00:20 +0000</pubDate>
		<dc:creator>Vincent</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.designersandbox.com/?p=888</guid>
		<description><![CDATA[A lot of the clients had request us with the following request, they want the footer to be &#8220;ALWAYS&#8221; appear on the very bottom without any JavaScript. So here you go. Also today we had completed the footer on our coming to launch Joomla templates Busuits, you can also view the footer in action under [...]]]></description>
			<content:encoded><![CDATA[<div id="post-refEl-888"><p><img src="http://www.designersandbox.com/wp-content/uploads/2010/01/always_bottom_footer_with_css.png" alt="" title="always_bottom_footer_with_css" width="500" height="300" class="alignnone size-full wp-image-889" /><br />
A lot of the clients had request us with the following request, they want the footer to be &#8220;ALWAYS&#8221; appear on the very bottom without any JavaScript. So here you go. Also today we had completed the footer on our coming to launch Joomla templates Busuits, you can also view the footer in action under <a href="http://joomla.designersandbox.com/vc-busuit/index.php?option=com_weblinks&#038;view=categories&#038;Itemid=48" target="_blank">here</a>.</p>
<p><span id="more-888"></span></p>
<div class="steps">
<h3>CSS for your always bottom footer</h3>
<p class="nomargin"><strong>CSS &#8211; always bottom footer</strong></p>
<pre class="brush: css;">
html,body{margin:0; padding:0; height:100%;}
#vc-main{min-height:100%; position:relative;}
#vc-header{background:#9F0;}
#vc-body{padding-bottom:80px;} /* Height of the footer */
#vc-footer{position:absolute; bottom:0; width:100%; height:80px;/* Height of the footer */background: #FC0;}
p, h1{padding:10px; margin:0;}
</pre>
</div>
<div class="steps">
<h3>CSS hack for your Internet Explorer 5.5, 6 and 7</h3>
<p class="nomargin"><strong>ie hack</strong></p>
<pre class="brush: xml;">
&lt;!--[if lte IE 7]&gt;
&lt;style type=&quot;text/css&quot;&gt;
#vc-main{height:100%;}
&lt;/style&gt;
&lt;![endif]--&gt;
</pre>
</div>
<div class="steps">
<h3>HTML</h3>
<p class="nomargin"><strong>html code</strong>. Place this html code within your html tag</p>
<pre class="brush: xml;">
&lt;body&gt;
&lt;div id=&quot;vc-main&quot;&gt;
    &lt;!-- BEGIN: HEADER--&gt;
    &lt;div id=&quot;vc-header&quot;&gt;
    &lt;p&gt;Header here&lt;/p&gt;
    &lt;/div&gt;
    &lt;!-- END: HEADER --&gt;

    &lt;!-- BEGIN: BODY --&gt;
    &lt;div id=&quot;vc-body&quot;&gt;
    &lt;p&gt;Body here&lt;/p&gt;
    &lt;/div&gt;
    &lt;!-- END: BODY --&gt;

    &lt;!-- BEGIN: FOOTER --&gt;
    &lt;div id=&quot;vc-footer&quot;&gt;
    &lt;p&gt;Footer here&lt;/p&gt;
    &lt;/div&gt;
    &lt;!-- END: FOOTER --&gt;
&lt;/div&gt;
&lt;/body&gt;
</pre>
</div>
<div class="infobox">
<strong>See the always bottom footer in action:</strong> <a href="http://demo.designersandbox.com/always_bottom_footer/index.html" target="_blank">Plain HTML</a> | <a href="http://joomla.designersandbox.com/vc-busuit/index.php?option=com_weblinks&#038;view=categories&#038;Itemid=48" target="_blank">Joomla Demo</a></p>
<hr />
<strong>Download:</strong> <a class="downloadlink" href="http://www.designersandbox.com/wp-content/plugins/download-monitor/download.php?id=4" title="Version1.0 downloaded 1364 times" >Always bottom footer with CSS only - Download (1364)</a>
</div>
<div class="infobox">
<h3>Be a link sponsor for this page now</h3>
<p>[sponsorbox]<br />
<hr />
</div>
<img src="http://www.designersandbox.com/?ak_action=api_record_view&id=888&type=feed" alt="" /><h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://www.designersandbox.com/code/the-beginning-of-web3-0-web-design-new-approach-scrolling-page-animation/" title="The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation">The beginning of web3.0 &#8211; Web Design New Approach &#8211; Scrolling Page Animation</a> (5)</li><li><a href="http://www.designersandbox.com/code/how-to-make-a-proper-css-button/" title="How to make a proper CSS button">How to make a proper CSS button</a> (1)</li><li><a href="http://www.designersandbox.com/announcement/designersandbox-roadmap-on-post-it/" title="DesignerSandbox Roadmap on post-it">DesignerSandbox Roadmap on post-it</a> (3)</li><li><a href="http://www.designersandbox.com/sharing/22-css-jquery-solutions-showcase-tutorials-beautify-your-website-now/" title="22 CSS/jQuery Solutions Showcase Tutorials, Beautify Your WebSite Now">22 CSS/jQuery Solutions Showcase Tutorials, Beautify Your WebSite Now</a> (4)</li><li><a href="http://www.designersandbox.com/code/centering-a-div-block-without-the-width-using-pure-css-all-browser/" title="Centering a div block without the width using pure CSS (All Browser)">Centering a div block without the width using pure CSS (All Browser)</a> (0)</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.designersandbox.com/code/always-bottom-footer-with-css-only-tutorials/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	<img style='margin:0;padding:0;border:0;' width='1px' height='1px' src="http://www.designersandbox.com/wp-content/plugins/mystat/mystat.php?act=time_load&id=2325504&rnd=790458015" /></channel>
</rss>

