Include Path

What is include_path?

To include a file in your PHP script you use the include statement. Hard coding the complete file system path in all your include statements is unmaintainable. You cannot expect your application to be installed in the exact same location everywhere. Including the files from a relative path is so much more easier.

Let us write few simple scripts for demonstration purpose.

Create the file mymainfile.php and paste the below code in it.


<?php
/* @file mymainfile.php
 *
 */
echo "This is the main file" "\n";
include 
'subfile.php';
?>
Programming: 
Content Type: 

PHP Essentials

PHP Essentials is a tutorial aimed to help boost your PHP knowledge. The tutorial assumes you have some experience writing PHP scripts.

I have seen many people struggle with Zend Framework because of lack of PHP knowledge. Reading this series before you start using Zend Framework or any other PHP framework will help you immensely.

Programming: 
Content Type: 

How To Access View Object From View Helper

From your view helepr you might want to access

  • view object properties
  • the view object
  • another view helper

You will be able to do all of the above if the view object is available in your view helper. To make sure view object is available to your helper do any of the following

  • Easiest method: Extend Zend_View_Helper_Abstract
    Example:

    class My_View_Helper extends Zend_View_Helper_Abstract{}
  • Implement the Zend_View_Helper_Interface
Programming: 
FOSS Project: 

How To Access The Request Object From Any Part Of Your Application

The request object contains the name of the module, controller, action and the request parameters. Sometimes, you might want to access the request object outside the controller or controller plugin.

For example a user on #zftalk just asked
"how can I access request object within form's method?"

The front controller instance is a singleton. This means we can get the instance of the front controller from any part of our application using the static method getInstance().

FOSS Project: 
Content Type: 
Programming: 

OpenOffice.Org Won't Launch

I encountered this annoying issue today. OpenOffice.Org won't lunch at all. Clicking the OpenOffice.org icon from the GNOME panel application menu and clicking on a ODS file in nautilus had the same results. I could see the window information 'starting openoffice.org' on the bottom GNOME panel. It would soon disappear.

To troubleshoot the issue, I updated the system. There were new OpenOffice.org-* packages available. Updating the packages didn't fix the issue.

Taxonomy upgrade extras: 

Know The Difference Between Zend And Zend Framework

Many people think 'Zend' is the latest trend in PHP. They also think the popular PHP library out there is called Zend.

These notions are absolutely wrong. Before you start working with Zend Framework, get to know the facts.

Zend is a company that has several products - Zend engine, Zend Studio, et all. Zend develops a PHP library with community contributions. This library or framework is known as the Zend Framework.

If you find yourself saying something like , "I tried Zend and I didn't like it, so I use Cake", it is high time you read more about these:

http://www.zend.com/

Content Type: 
Programming: 
FOSS Project: 
General: 

Exporting MySQL Data To CSV In PHP

Do you want to export data stored in a MySQL database to CSV file?

The solution is damn easy if you already know how to connect to MySQL database and read or display data from a PHP script. Let's start working on it.

Let us first create a sample table. In our example scenario, let us create a table to store contact information.


CREATE TABLE `contacts` (
`first_name` VARCHAR( 50 ) NOT NULL ,
`middle_name` VARCHAR( 50 ) NOT NULL ,
`last_name` VARCHAR( 50 ) NOT NULL ,
`email` VARCHAR( 320 ) NOT NULL ,
`phone` VARCHAR( 20 ) NOT NULL
) ENGINE = MYISAM;

Taxonomy upgrade extras: 

CTRL+L Keyboard Shortcut Won't Lock Screen In GNOME

In the recent past, the default keyboard shortcut, CTRL+L set to lock the screen had stopped working. I tried manually setting different keyboard shortcuts like CTRL+ALT+L. None of them would work.

To set the keyboard shortcuts

  • Click System on the GNOME Panel
  • Click Preferences from the drop down menu
  • Click Personal and then click Keyboard Shortcuts
  • Select an action and then type the keyboard shortcut
  • Click Close
Taxonomy upgrade extras: 

Scrolling In Firefox Is Horribly Slow

Is scrolling vertically on web pages in your Firefox horribly slow?

I encountered this issue recently on Fedora 10. Initially, I suspected the binary NVIDIA driver. But I was wrong. I found a simple solution.

Disable smooth scrolling in the Firefox preferences.

  • On the Firefox window click Edit
  • Click Preferences
  • Click Advanced tab
  • Click Use Smooth Scrolling to uncheck the checkbox
  • Click Close

Viola.

Taxonomy upgrade extras: 

Mini Build Script For Dojo Toolkit 1.2.3

When you use a JavaScript framework, library or toolkit in production, you would be interested in improving the performance of the application by:

  • Reducing the footprint of the JavaScript code by compressing it, removing comments, white spaces, etc
  • Reducing the number of HTTP requests, especially in Ajax applications
  • Removing documentation, tests and other project files to be productive with FTP, SCP and VCS operations
Taxonomy upgrade extras: 

Pages