php code to save files on user machine

I was trying to save the ‘.xls’, ‘.doc’, ‘.wmv’ on user machine, which works correctly on Firefox(developer friendly) but not on Microsoft’s IE(Microsoft friendly); after searching on the net, i found this code which works on both the browser. here is the code: ————————- <?php // downloading a file $filename = $_GET[‘path’]; // fix for […]

PHP Script to load a PDF

To get PHP to load a PDF (for example) from file, use the following code. <?php $filename = $_SERVER[‘DOCUMENT_ROOT’] . “/path/to/file/my_file.pdf”; header(“Cache-Control: public”); header(“Content-Description: File Transfer”); header(‘Content-disposition: attachment; filename=’.basename($filename)); header(“Content-Type: application/pdf”); header(“Content-Transfer-Encoding: binary”); header(‘Content-Length: ‘. filesize($filename)); readfile($filename); ?>

Cannot modify header information – headers already sent

Warning: Cannot modify header information – headers already sent by (output started at /home/domain/public_html/file.php:42) in home/domain/public_html/includes/main.php on line 302 Solution The “headers already sent” error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>). Remove the additional spaces , this should solve the […]

Creloaded template gives error

You must have noticd several time that the creloaded template when installed gives error The simplest solution is as follows Eg error 1054 – Unknown column ‘popt.products_options_name’ in ‘field list’ select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from products_options popt, products_options_values poval, products_attributes pa where pa.products_id = ‘698{2}7’ and pa.options_id = ‘2’ and pa.options_id = popt.products_options_id and […]

Change group and owners of files and folders on Linux server

chown command – change the owner of a file You must be either the root user or the owner of the file in order to change the group ownership. To change the group and owners of files and folders on the linux server use the below command Set the file’s owner: $ chown username filename […]

How to restore compressed mysql backup file

To restore compressed backup files you can do the following: gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] If you need to restore a database that already exists, you’ll need to use mysqlimport command. The syntax for mysqlimport is as follows: mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]

Upgrade from WordPress 2.5.x to WordPress 2.6 in easy steps

Step 1 : Backup your existing files of wordpress site . Step 2 : Backup your wordpress database. Step 3 : Deactivate your plugins. A plugin might not be compatible with the new version, so it’s nice to check for new versions of them and deactivate any that may cause problems. You can reactivate plugins […]

How to insert html code in Joomla content or module?

Many of the times there is need or requirement to insert raw HTML in a Joomla article or module. For example, embedding Google maps etc. Unfortunately, sometimes the editor screen you are using will strip out the HTML code, or cause an error. Rather than having to turn the editor on/off in global configuration, there […]

How to find the module positions for a new or existing Joomla template?

To find the module positions in your Joomla 1.0.x or  Joomla  1.5.x template simply add  the following  to your URL /index.php?tp=1 for eg. if your domain name is www.mydomain.com,  then to find the module position type in the addressbar www.mydomain.com/index.php?tp=1

Adding new module position to Joomla 1.0.x and 1.5.x

In Joomla 1.0.x we can add new module positions by going to Site -> Template manager -> module positions (total 50 places). [Add your position] However in Joomla 1.5.x we need to add the module positions within the templatedetails.xml under the active template folder <positions> <position>hornav</position> <position>breadcrumbs</position> <position>banner</position> <position>left</position> <position>right</position> <position>top</position> <position>search</position> <position>topsl</position> <position>user1</position> <position>user2</position> […]

Installing Joomla 1.5.x

With the increasing popularity of Joomla most people are moving towards Joomla. I would like to take the initiative to help the new Joomla family members installing Joomla 1.5.x version on their server Please follow the following steps Download joomla package from joomla.com Decompress the file downloaded Login to your FTP server Upload the extracted […]

What is MVC pattern in Joomla ?

With the introduction of joomla 1.5.x, I was very excited to learn the new architecture implemented. With the increasing popularity of Joomla 1.5.x I could not stop myself teach myself the new Joomla MVC pattern. MVC stands for Model View Controller MVC is an architectural pattern used in software engineering. The model-view-controller solves this problem […]