web page is not cached, across all browsers

set of headers which works in all of the mentioned browsers is the following:

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

The PHP way would look like:

header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
header('Pragma: no-cache'); // HTTP 1.0.
header('Expires: 0'); // Proxies.

The Java/Servlet way would look like:

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.

The ASP.NET way would look like:

Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
Response.AppendHeader("Expires", "0"); // Proxies.

The plain HTML way would look lile:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

The Cache-Control is per the HTTP 1.1 spec for clients (and implicitly required by some browsers next to Expires),
the Pragma is per the HTTP 1.0 spec for clients and proxies and Expires is per the HTTP 1.1 spec for clients and proxies. Other Cache-Control parameters are irrelevant if the abovementioned three are specified. The Last-Modified header is only intersting if you actually want to cache the request.

Change suffix from html to htm in Joomla

Goto includes/router.php
Line 57 : Replace the current code there with ,

if($suffix = pathinfo($path, PATHINFO_EXTENSION))
$path = str_replace('.'.$suffix, '', $path);
$vars['format'] = $suffix;
if ($suffix == 'htm')
$path = str_replace('.'.$suffix, '', $path); //pair of single quotes inserted
$vars['format'] = 'html';
} else {
$path = str_replace('.'.$suffix, '', $path); //pair of single quotes inserted
$vars['format'] = $suffix;

Then goto line 101 : Replace the current code there with ,

if($format = $uri->getVar('format', 'html'))
$route .= '.htm';

If you need the suffix to change from .html to .php , then just replace the .htm in the above code by .php and thats it..

if you are still not able to do it, then just download this ,
router.php file and upload it to includes folder.

Virtuemart- Set the number of products per page

Add $limit=5; in line after $ps_product_attribute = new ps_product_attribute;
in /administrator/com_virtuemart/html/shop.browse.php

CSS Hacks for Different Versions of Firefox

CSS hacks targeting different versions of Firefox. Some of these CSS Firefox hacks are organized according to version number and presented with ease of copying and pasting in mind. That said, here are some notes that apply to all of the hacks in this article.
  • For each hack, change only #selector, .selector, and of course the declaration blocks.
  • Hacks that do not validate as CSS are designated with [!] in the associated comment.
  • If you discover any inconsistencies, incompatibilities, or inoperabilities, please leave a comment.
  • This post is a work in progress. Please share any Firefox hacks that are not on the list.

Types of CSS hacks

1. target -
We are referring to the application of CSS styles to a particular, targeted browser (or set of browsers) at the exclusion of all others.

2. filtering
We are referring to the application of CSS styles to every browser except a particular browser (or set of browsers).

CSS Hacks targeting all Firefox

/* Target all Firefox */
#selector[id=selector] { color: red; }
/* Target all Firefox */
@-moz-document url-prefix() { .selector { color: red; } }

/* Target all Gecko (includes Firefox) */
*>.selector { color: red; }

CSS Hacks targeting Firefox 1.5 and newer

/* Target Firefox 1.5 and newer [!] */
.selector, x:-moz-any-link, x:only-child { color: red; }

CSS Hacks targeting Firefox 2 and older

/* Target Firefox 2 and older [!] */
body:empty .selector { color: red; }

/* Target Firefox 2 and older */
#selector[id=SELECTOR] { color: red; }

/* Target FireFox 2 and older [!] */
html>/**/body .selector, x:-moz-any-link { color: red; }

CSS Hacks targeting Firefox 3

/* Target FireFox 3 [!] */
html>/**/body .selector, x:-moz-any-link, x:default { color: red; }

Unzip an uploaded file using php

If you dont have shell access to your server and need to unzip a file on your php server you can use the script below:

Example 1. Extract all entries

$zip = new ZipArchive;
if ($zip->open('') === TRUE) {
echo 'ok';
} else {
echo 'failed';

Example 2. Extract only two entries

$zip = new ZipArchive;
$res = $zip->open('');
if ($res === TRUE) {
$zip->extractTo('/my/destination/dir/', array('pear_item.gif',
echo 'ok';
} else {
echo 'failed';


ZipArchive::extractTo -- Extract the archive contents


mixed ZipArchive::extractTo ( string destination [, mixed entries] )
Extract the complete archive or the given files to the specified destination.


destination - Location where to extract the files.
entries - The entries to extract. It accepts either a single entry name or an array of names.
Return Values - Returns TRUE on success or FALSE on failure.

PHP Cron Jobs with cPanel

Cron jobs allow you to automate certain commands or scripts on your server to complete repetitive tasks automatically. A cron job allows you to run a certain command at times set by the job. For example, you could set a cron job to delete temporary files every week so that your disk space is not being used up by those files.

1. you can get started with the simple cron tool built into cPanel.url:

To access the Cron Jobs Menu, click on the corresponding icon located on the main screen of your cPanel interface.

2. The cron email section of the Cron Jobs interface allows you to specify the email address where you would receive an email each time a cron job is ran for your account.

If you do not want an email to be sent for an individual cron job you can redirect the command's output to /dev/null like this:
mycommand >/dev/null 2>&1

You can enter the desired email address in the text box and click the Update Email button to apply the changes.

3. Next section of the Cron Job interface is where you actually set your cron jobs.
Once ready setting up the cron job click the "Add New Cron Job" button and it will be saved and activated for your account.

Want to select an option from all the select boxes. Remember to select an option in each box.

If you want something to run every day at 4AM:
select Minute: 0; Hour: 4; Day: Every; Month: Every; Weekday: Every;

4. The bottom part of the Cron Jobs interface will allow you to edit or delete existing cron jobs.

The command to run:
php -q /home/(username)/public_html/(scriptname).php

Paypal "Buy Now" Button HTML Code

When you use PayPal's Buy Now Buttons, you can sell individual items from your website, or even using a link in an email! Buy Now Buttons is a low–cost way for you to accept credit card and bank account payments, and can be fully integrated with your website in a few easy steps.

The example code below shows the minimum information you need to create a Buy Now button (in this case, to purchase a teddy bear):

<form name="_xclick" action="" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">

Dynamic Button Generation

If you dynamically generate portions of your site, save time by updating the variables with information from your database. To use the button above for a different item, edit the values for two variables:
  • item_name
  • amount