开发者

how to create a content plugin on joomla

开发者 https://www.devze.com 2023-02-12 10:04 出处:网络
I want to create a content plugin on Joomla. i want to put [picasa id=\"5551971516356491729\"] and that the album will show.

I want to create a content plugin on Joomla.

i want to put [picasa id="5551971516356491729"] and that the album will show.

开发者_JAVA百科

i create a php function that return html for the album.

i will need to had the js code for the light-box.

i have a content plugin that create the light-box can i applay content plugin on another one?

i meen that my plugin will create a code like that [lightbox link="www.example.com/image1.jpg"] and the light-box plugin will generate the html?


Start here http://docs.joomla.org/Creating_a_content_plugin

Your primary function would look something along the lines of...

function onPrepareContent( &$article, &$params, $limitstart )
{
    $pattern = '/(\W)[picasa id="([0-9_]+)"](\W)/';
    $replacement = '$1<a href="http://www.example.com/image1.jpg/$2">@$2</a>$3';
    $article->text = preg_replace($pattern, $replacement, $article->text);

    return true;
}

You will need to format the new html in a way that your lightbox plugin will detect it and do it's magic.

0

精彩评论

暂无评论...
验证码 换一张
取 消