Actions

Difference between revisions of "Platform Applications Tips and Tricks"

From Joomla! Documentation

m
m (category added)
 
Line 81: Line 81:
  
 
[[Category:Platform]]
 
[[Category:Platform]]
 +
[[Category:Development Tips and Tricks]]

Latest revision as of 13:16, 29 August 2012

You can make web and command line applications on the Joomla Platform. The

Contents

CLI Applications

Making sure you can run PHP CLI applications

To make sure you can run php on your command line you can do the following test: Make a file called clitest.php that consists of:

<?php echo "Hello World"; ?>

Then at your command prompt type: php clitest.php You should get a Hello World message.


Setting Error Handling

 
// Set error handling levels
 
JError::setErrorHandling( E_ERROR, 'echo');
JError::setErrorHandling( E_WARNING, 'echo' );
JError::setErrorHandling( E_NOTICE, 'echo' );

Setting Error Reporting

Turn error reporting to high with:

/**
 
 * Turn on strict error reporting during development
 
 */
 
ini_set('display_errors', '1');
 
ini_set('error_reporting', E_ALL | E_STRICT);

Configuration

You can make a configuration.php file just like in the CMS to store your database and other information. Use fetchConfigurationData() to get the information.

If you don't need configuration you can do this:

        protected function fetchConfigurationData()
        {
        return array();
        }

Web Applications

Sessions with no database

If you are not using a database you should put:


// We're setting session to false because we aren't using a database so there is no where to store it.
$config = Array ('session'=>false);

to keep the application from attempting to store a session.

Configuration

You can make a configuration.php file just like in the CMS to store your database and other information. Use fetchConfigurationData() to get the information.

If you don't need configuration you can do this:

        protected function fetchConfigurationData()
        {
        return array();
        }