osCommerce PHP4 -> PHP5 Fixes

September 15, 20083 Comments

There are a few problems that come from moving an old install of osCommerce to a new server with PHP5 or just simply upgrading from PHP4 to PHP5. (more…)

Put LazzyMonk’s Blog onto the Magento Main Page

September 2, 2008Leave a reply

On the CMS page that you want to see the blog on, just use the following code:

{{block type=”blog/blog” template=”blog/blog.phtml”}}

MySQL Update Query

February 21, 2008Leave a reply

Reminder to myself what a MySQL update query looks like.

UPDATE products SET
products_length=0, products_width=0, products_height=0
WHERE products_width=’12′;

Easy PHP/Javascript rollover images for osCommerce links

February 14, 2008Leave a reply

The javascript portion:

<?php
function JavaCatTab($num) {
    echo ‘tab’ . $num . ‘up       = new Image();’;
    echo ‘tab’ . $num . ‘up.src   = "images/design/tab_’ . $num . ‘.gif" ;’;
    echo ‘tab’ . $num . ‘down     = new Image() ;’;
    echo ‘tab’ . $num . ‘down.src = "images/design/tab_’ . $num . ‘down.gif" ;’;
}
?>
<script language="JavaScript" type="text/javascript">
<!–
if (document.images) {
<?php
    JavaCatTab(’01′);
    JavaCatTab(’02′);
    JavaCatTab(’03′);
    JavaCatTab(’04′);
    JavaCatTab(’05′);
    JavaCatTab(’06′);
    JavaCatTab(’07′);
?>
}
function buttondown( buttonname )
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "down.src" );
    }
}
function buttonup ( buttonname )
{
    if (document.images) {
      document[ buttonname ].src = eval( buttonname + "up.src" );
    }
}
// –>
</script>

The links portion (place below the first part somewhere):

<?php
function catTab($num, $link) {
    echo ‘<a onmouseover=buttondown("tab’ . $num . ‘") onmouseout=buttonup("tab’ . $num . ‘") href="’ . tep_href_link(FILENAME_DEFAULT, $link) . ‘">’;
    echo ‘<img src="images/design/tab_’ . $num . ‘.gif" name="tab’ . $num . ‘" border="0" />’;
    echo ‘</a>’;
}

catTab(’01′,‘cPath=48′);
catTab(’02′,‘cPath=62′);
catTab(’03′,‘cPath=56′);
catTab(’04′,‘cPath=59′);
catTab(’05′,‘cPath=55′);
catTab(’06′,‘cPath=63′);
catTab(’07′,‘cPath=57′);
?>

Firebug Addon for Firefox

December 6, 2007Leave a reply

“Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.”

Install to Firefox.

Shorter nested IF statements in Excel

November 27, 2007Leave a reply

This code checks to see if A1 equals the letters K, H or L.

Instead of using:

=IF(A1="K",TRUE,IF(A1="H",TRUE,IF(A1="L",TRUE,FALSE)))

You can use:

=IF(OR(A1="K",A1="H",A1="L"),TRUE,FALSE)

As you can see, it’s a lot shorter and makes a lot more sense. Especially if you need to add more to it in the future.

Easy stylesheets with basic PHP

November 14, 2007Leave a reply

Create a file called stylesheet.php and link to it in you’re page. Then play with this code:

<?php
header(‘Content-type: text/css’);

// Colour scheme
$primary    = "#44749d";
$secondary  = "#c6d4e1";
$tertiary   = "#ffffff";
$quaternary = "#ebe7e0";
$quinary    = "#bdb8ad";
?>

BODY {
background: <?php echo $tertiary ?>;
color: #000000;
margin: 0px;
}

Page 2 of 2«12