How To Edit a PHP File

How To Edit a PHP File

Have you ever needed to find where some php code is on your site?

You might need to change something such as the length of the product name on your product info page.

Well to find the script, you need to edit go to the page on your site which displays the screen where you want to make the change and look in the address bar of your browser.

Find the bit that ends .php, this is the file you need to start looking at.


In this case product.info.php is the file to start with, now you have to find the script on your site. As there are literally thousands of ways everyone puts their files up on their server you need to browse around your site and find it.

You can use an ftp client such as filezilla or your host's file manager.

When you find it, download the file to your pc and take a backup copy.

Now you can edit the file and always be able to get back to a working site.

Search for product_name in the file.

if (tep_not_null($product_info['products_model'])) {
$products_name = $product_info['products_name'] . '
[' . $product_info['products_model'] . ']';
} else {
$products_name = $product_info['products_name'];

Now you can amend the code to your hearts content.

$products_name = substr($product_info['products_name'], 0, 22)."...";

Once you have saved your changes, rename your original file on the server to be called product_info_orig.php.

You site will now be broken so quickly copy your edited file back to your site to where it was origionally and test the results.

If it works, fine, if not, you can delete product_info.php and rename product_info_orig.php to product_info.php and everything will be back working as it was origionally.


Customers who bought this product also purchased
Forgotten Admin Password
Forgotten Admin Password
How to Setup Paypal Website Payments Standard
How to Setup Paypal Website Payments Standard
0 items
Share Product
Share via E-Mail Share on Facebook Share on Twitter Share on Google Buzz Share on Digg
Manufacturer Info
Other products
Quick Find
Use keywords to find the product you are looking for.
Advanced Search