Introduction
This tutorial shows how to do things, which are all other plugin do for core Joomla content.
First it is important to understand difference between Core Joomla Content (CJC) and Mighty Content (MC). CJC has only one field and it's type html. So it is more easier to treat that. JSC has unpredictable number of fields and types. There may be custom field types developed especialy for some project. Thus there are 2 differenses.
1 difference - number of fields
Let me tel you example. You have comment plugin (though Mighty Content has comments built-in). This plugin attach or append to the end of article text link to comments and show how many comments are already there. This is ok if you have one field like CJC. But if you have many fields? Then we will get comments(0) link as many times as there are many fields. The conclusion is that there are 2 types of plugins. First is text parsers, plugins that replase {SOMETHING} to ANYTHING and Appending plugins that add to the end othe article additional inforation.
In CJC it may be done in one event but in MC ther are 2 different events for that.
One is onBeforeFieldRender - treat every field used basicaly for parser plugins. Thhis event is called before render or even prepare any field value. But do not forget skip usless types (read second difference).
Other onAfterArticleRender or onBeforeArticleRender.These events may be used for adding something before or after article. But realy you can reposition that in template.
2 difference - different types
This should be taken in account when you create parser like plugins. This means you need to skip types or treat only special type. like in example below that do something only with HTML texts. And this opens endless possibilities. imagine what you can do with picture type for example. Though it may be implemented in field plugin, you may place watermark on the fly or for email field send some alert to this email, and it is just what come to mind but relay it much bigger area.
Installation
You need to install plugins to joomsuite_content group. E.g. in installation XML
<install version="1.5" type="plugin" group="joomsuite_content" method="upgrade">
Plugin Example
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.plugin.plugin' ); class plgJoomsuite_contentExample extends JPlugin { function plgJoomsuite_contentExample( &$subject, $params ) { parent::__construct( $subject, $params ); } function onBeforeFieldRender(&$field, &$user) { $field_id = $field->id; $field_value = $field->field_value; $field_params = new JParameter($field->params); $title = $field->title; $type = $field->type; if($type == 'html') { $field->field_value = str_replace("{PLACE_HOLDER}", "Something Here", $field_value); } } function onAfterArticleRender(&$article, $params) { $title = $article->title; $article_id = $article->id; $text = ''; if($mode == 'list') { $text .= "This is article in list vew"; } else { $text .= "This is article details"; } return $text; } function onBeforeArticleRender(&$article, $params) { // same parameters here } function onArticleSubmit(&$record, $params) { } function onCommentsRender(&$record, &$comments, &$params) { } function onBeforeListRender(&$params) { } } ?>
on
on 
+1 (209) 800 1209