Entries Tagged 'Web Development' ↓

Mootools iTunes like image flip gallery

This iTunes image flip gallery script utilizes Mootools v1.2. A direct link to the script

It's great to see the internet move away from flash more and more everyday.

Strip HTTP:// www. and/or suffixes from URL with PHP

This code shows how to strip http, www, or any suffixes. The most efficient way is to toss an array at str_replace. If anyone write this will all the suffixes please post in comments!

function remove_http($url){
$remove = array('http://','https://','www.','.com','.org','.net','.co.uk','.name','.info','.cc','.biz','.us','.gb','.tt');
$stripedUrl = str_replace($remove, '', $url);
return strtolower($stripedUrl);
}

Example:

<? echo remove_http("http://www.DesignCodeExecute.com") ?>

Result:

designcodeexecute

PHP Object Array Access: Cannot use object of type stdClass as array

To access an object in PHP you use a pointer. For example when using Browscap (http://code.google.com/p/phpbrowscap/) extract the values like so

$current_browser->Parent;

Internet Explorer Bug: ie6 cuts off bottoms of words

A Frequent Problem with ie6: The bottom of the text (e.g. g y p) get cut off and make text illegible. This mostly happens with two line breaks and can be fixed by using a larger line-height in css.

To fix the problem we are going to create a class using the internet explorer 6 box hack.

We need to locate the exact area that we are having the problem with. For me the text was being cut off at .description h4 a

* HTML .description h4 a {
      line-height: 1.2em;
}

To fix the text cut off issue without the box hack just simply created a css class and adjsut the line-height

p { line-height: 1.2em; }

Clear/Remove/Blank out Value from Input Form

In your HTML HEADER add this code

<script type="text/javascript">
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
</script>

In your html input tag add this code

onfocus="clearText(this);"

Installing Spanish in Zen Cart Admin Error

Upon installing spanish on the front end, I recieved an error in yellow about not having the correct files for the language spanish, yet the front end spanish worked. To fix the problem download this zip, unzip and drop the admin folder into your root zen directory. Then push all the files to the server.

Download Admin Spanish Pack for Zen Cart 1.3.8 Now

Font size and Font Family Javascript Changing Tool

<script type="text/javascript" language="javascript">

function changeColor(str)
{
document.getElementsByTagName("BODY")[0].style.background = str;
}

function changeFont(str)
{
document.getElementsByTagName("body")[0].style.fontFamily = str;
}

function changeSize(str)
{
document.getElementsByTagName("p")[10].style.fontSize = str;
document.getElementsByTagName("p")[2].style.fontSize = str;
document.getElementsByTagName("p")[3].style.fontSize = str;
document.getElementsByTagName("p")[5].style.fontSize = str;
document.getElementsByTagName("p")[6].style.fontSize = str;
document.getElementsByTagName("p")[7].style.fontSize = str;
document.getElementsByTagName("p")[8].style.fontSize = str;
document.getElementsByTagName("p")[9].style.fontSize = str;
}
function hide(){
var jet = document.getElementById('jetscram').style;
jet.visibility="hidden";

}

</script>

<style type="text/css">
div#jetscram{ background:url(http://jetscram.com/images/logo.gif) top left no-repeat; background-color:#ffffff; border:6px #333 solid; font-family:Helvetica, Arial, sans-serif; color:#333; height:28px; padding-left:65px; padding-top:12px; position:fixed; bottom:0; width:594px; left:50%; margin-left:-342px; z-index:5;}
#jetscram select{ width:120px;}
* HTML div#jetscram{ margin-left:0px;}

</style>

<div id="jetscram">
Font <select name="fontchange" onchange="changeFont(this.value)">
<option value=""Gill Sans MT", Gill Sans, Gill,Arial, Sans" selected="selected">Gill Sans MT</option>
<option value="Arial, Sans">Arial</option>
<option value="Verdana, Sans">Verdana</option>
<option value="Helvetica,"Helvetica LT", Sans">Helvetica</option>
<option value="Georgia, Sans">Georgia</option>
</select>
Font Size
<select name="fontsize" onchange="changeSize(this.value)">
<option value="12px">12</option>
<option value="13px">13</option>
<option value="14px">14</option>
<option value="15px">15</option>
<option value="16px" selected="selected">16</option>
<option value="18px">18</option>
</select>
Background Color
<select name="backgroundcolor" onchange="changeColor(this.value)">
<option value="#008ed7">0%</option>
<option value="#005fb2">33%</option>
<option value="#012f8b" selected="selected">66%</option>
<option value="#010066">100%</option>
</select>
<a href="#" onclick="hide()" >hide</a>
</div>