What is jdoc:include type=message?

There is now a new jdoc with the syntax <jdoc:include type=”message” /> which now serves as the output of many system messages… think of it as a specialized module.

For your site visitors to see these messages, this include HAS to be somewhere in the template. Check if your template has it, and if is doesn’t add it to the index.php. A good place would be just before <jdoc:include type=”component” />.

While you are in the index.php, make sure you add the css styles that will give these messages some style and color. To do this add the following lines to your <head> to call in Joomla 1.5′s system CSS:

<link rel=”stylesheet” href=”<?php echo $this->baseurl ?>/templates/system/css/system.css” type=”text/css” />
<link rel=”stylesheet” href=”<?php echo $this->baseurl ?>/templates/system/css/general.css” type=”text/css” />

Its likely that component developers will start taking advantage of this include to provide system messages. make sure its in your templates!

Advertisements

How to include an external file in Joomla?

In some cases, you need to add an external file beside joomla file system in a module and component. In this case, your external file can’t use the joomla libraries easily. Following is the way to use the external file.
Add following 10 lines of code on top of your external file.

define( ‘_JEXEC’, 1 );
define(‘JPATH_BASE’, dirname(__FILE__));
define( ‘DS’, DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.’includes’.DS.’defines.php’ );
require_once ( JPATH_BASE .DS.’includes’.DS.’framework.php’ );
$mainframe =& JFactory::getApplication(‘site’);
$mainframe->initialise();
/* If you need to use database object, add following line too */
$db=JFactory::getDBO(); // use this $db object for database related operation

Now, use this file as normal joomla file. You can include the joomla libraries  files as per the requirement also.