How to include PHP commands in Section/Content Description (for Joomla 1.0.x)? |
| Written by kksou | ||
| Tuesday, 22 April 2008 | ||
|
The DirectPHP plugin which I released in March 2008 allows you to include PHP commands in content items only. This article shows you how to include PHP commands right inside Section/Category description. You can see a live example here. Solutions
Note: If you've already installed the plugin loadmodule for Section/Category Description, you can skip this step.
class HTML_content {
/**
* Draws a Content List
* Used by Content Category & Content Section
*/
function showContentList( $title, &$items, &$access, $id=0, $sectionid=NULL,
$gid, &$params, &$pageNav, $other_categories, &$lists, $order,
$categories_exist ) {
global $_MAMBOTS;
$_MAMBOTS->loadBotGroup( 'content' );
$results = $_MAMBOTS->trigger( 'onBeforeDisplayTitle', array( &$title) );
global $Itemid, $mosConfig_live_site;
if ( $sectionid ) {
$id = $sectionid;
}
// Secrion/Category Description & Image
if ( $menu && $menu->componentid && ( $descrip || $descrip_image ) ) {
$link = $mosConfig_live_site .'/images/stories/'. $description->image;
echo '<tr>';
echo '<td valign="top">';
if ( $descrip_image && $description->image ) {
echo '<img src="'. $link .'" align="'.
$description->image_position .'" hspace="6" alt="" />';
}
if ( $descrip && $description->description ) {
global $_MAMBOTS;
$_MAMBOTS->loadBotGroup( 'content' );
$results = $_MAMBOTS->trigger(
'onBeforeDisplayTitle', array( &$description) );
echo $description->description;
}
echo '<br/><br/>';
echo '</td>';
echo '</tr>';
}
// Leading story output
if ( $leading ) {
echo '<tr>';
echo '<td valign="top">';
Current date and time is: <?php echo date('Y-m-d H:i:s');?>
You should see the current date and time displayed in the section or category description. Very Important Note about the Editor!!!If you're using the default TinyMCE WYSIWYG Editor, you will face one problem. When you first enter PHP commands into the editor, encapsulated in <?php ... ?>, everything's ok. But as soon as you click the save button, all your PHP commands will disappear! Don't worry. They are all still there. But the problem is, unlike content items, the default TinyMCE WYSIWYG Editor refuses to display anything in tags. There are two solutions to this.
User reviews There are no user reviews yet. Note: You have to be a registered member to leave a comment. Free registration here. |
||
| < Prev | Next > |
|---|
Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla Plugins
Joomla Components
Joomla Gadgets
- Google Image Search
- Google News Search
- Wikipedia Search
- Google Book Search
- Google Video Search
- Google Currency Converter - AJAX version
- Yahoo Currency Converter - AJAX version
- Yahoo Stock Quote (AJAX module version)
- Yahoo Stock Quote (AJAX component/ module version)
- googleSearch_cse component
- googleSearch_cse module
- googleMaps plugin






