Zend Certified Engineer (ZCE) Study Guide Links


PHP Basics

Object Oriented Programming

PHP 4/5 Differences

  • Object Orientation
  • E_STRICT – In PHP 5 a new error level E_STRICT is available. As E_STRICT is not included within E_ALL you have to explicitly enable this kind of error level. Enabling E_STRICT during development has some benefits. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions.
  • References vs. Object Handles | Further Reading

Streams and Network Programming

Security

Functions

Databases and SQL

Strings and Patterns

Arrays

XML and Web Services

Web Features

Design and Theory

Reference

Advertisements

Get the width and height of an image using a function in PHP


This is a very useful function in PHP. PHP provides function to get the width and height of an image. The
getimagesize() function will determine the size of image file including flash file(swf).

Syntax

list($width, $height, $type, $attr) = getimagesize(“image_name.jpg”);

Code

This is a sample code, change image_name to your image name and test it!

<?php

list($width, $height, $type, $attr) = getimagesize(“image_name.jpg”);

echo “Image width ” .$width;
echo “<BR>”;
echo “Image height ” .$height;
echo “<BR>”;
echo “Image type ” .$type;
echo “<BR>”;
echo “Attribute ” .$attr;

?>

When you run this script you will see the result like this

Image width 379
Image height 344
Image type 2
Image attribute width=”379″ height=”344″

You will get the width, height, type of an image and also attribute of an image, I use this function in my image

upload form.

Type of an image you can see from table below You can read a full manual here

Type of the image
1 = GIF      5 = PSD          9 = JPC     13 = SWC
2 = JPG     6 = BMP     10 = JP2     14 = IFF
3 = PNG   7 = TIFF(intel byte order)               11 = JPX     15 = WBMP
4 = SWF   8 = TIFF(motorola byte order)     12 = JB2     16 = XBM

How to add date picker in joomla site…


In your component html file, put the following code at the top of your function:

JHTML::_('behavior.calendar');

Then for your date field in your form:

input class="inputbox" type="text" name="startdate" id="startdate" size="25" maxlength="25" value="" &
input type="reset" class="button" value="..." onclick="return showCalendar('startdate','%Y-%m-%d');"

Reset Webmin Password for ubuntu


I found this problem at the first time when webmin installed. Also this happens to everyone at one time or another. You go on vacation and when you come back, you forget all of the passwords on your computer.

I failed logging in several times and then Webmin blocked my IP. Getting localhost blocked isn’t a good thing to see. So I searched the Internet for a way to reset the password and I found this procedure:

1. Login to your computer as root. Type on browser address bar https://localhost:10000/
2. If you are running a Debian distribution (ubuntu), enter the following command:
/usr/share/webmin/changepass.pl /etc/webmin username password
3. Login to Webmin with your reset password.
4. eNjoY!

How to determine if the user is viewing the Joomla front page or not?


If you are using Joomla older version like 1.0 then you’ll only need to verify the current component with the following command:


if ($option == 'com_frontpage' || $option == '') {
echo 'This is the front page';
}

Bellow porsion for Joomla! 1.5 could be easily confirmed by the following command:


if ( JRequest::getVar('view') === 'frontpage' ) {
echo 'This is the front page';
}

Just in case the above command doesn’t work then the issue could be a little more complicated and need to check if the current active menu item is the default one. I saw this issue in some 1.5 early versions.


$menu =& JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
}

Adding custom columns/fields to Joomla article


Today we will learn how to add more columns/fields to Joomla *_content table. At first we should have to add a column in *_content table.
Run in for instance phpMyAdmin.
ALTER TABLE `jos_content` ADD `test` VARCHAR( 255 ) NOT NULL

Edit administrator/components/com_content/models/article.xml add:

In the first params section for instance below the access entry. Add var $test = null; to libraries/joomla/database/table/content.php
Now add $form->set('test', $row->test); to editContent() in administrator/components/com_content/controller.php
The result is that you now have a new field called test that can be used in various ways to display a separate text that is not a part of the article.

OpenCart open source E-commerce solution


OpenCart is an open source PHP-based online shopping cart system. A robust e-commerce solution for Internet merchants with the ability to create their own online business and participate in e-commerce at a minimal cost.

OpenCart is designed feature rich, easy to use, search engine friendly and with a visually appealing interface.

Download link here