Joomla and dynamic content/pages from mysql
i'm using Joomla 1.6 + mysql
What I want to do at this point is to create dynamic links using content that exists on the database.
At this point i'm calling a function in php that creates an ordered list with the contents of a certain table, but right now I want that those items contain not only the text on the database but also a link associated with that item, so that i c开发者_如何学JAVAan display inside my joomla website the content on the database.
In other words I have 'N' itens that will be changed over time, and i need to display those 'N' items using an ordered list (this part is already working for 'N' items) and then each item contains a link to a joomla page/article/... dynamically generated in some sort of way in order to show contents on the database associated with that Item.
Please note that this has to work dynamically because content on the database will change over time and the number of links can contain 0 to N items.
Any ideas or pointers to do this?
Thank you
The best way to do this is to create a small content plugin.
function onPrepareContent( &$article, &$params, $limitstart ) {
$plugin =& JPluginHelper::getPlugin('content', 'myplugg');
$pluginParams = new JParameter( $plugin->params );
// get your data from the db
$rows = ...
// assemble the html for insertion
$content2insert = ...
// append the content into the joomla article
$article->text = $article->text . $content2insert;
return true;
}
Here is a full tutorial on content plugins: http://docs.joomla.org/Creating_a_content_plugin
精彩评论