0

I've got a php file with a function in it which gets a list of items from a source file and then formats that list with some html. At the end, it returns a var ($html) containing the html formatted list.

What I'd like to know how to do is return this html formatted list to a content article, so it can be displayed in an article. I have several different articles wherein I'd like to display this list. So, what I'd like is to be able to write the content for each article and then, at some point in the article, display the list using a function call of some kind. I just don't know how to do this.

I should note that I'm using Joomla 1.5 (yeah, I know... it's completely out of my hands). I looked into adding plugins which would allow me to write php code right in a content article but there are two problems with that: 1) those plugins don't work with Joomla 1.5 and 2) Then I'd have to maintain the same code in several different articles.

Ideally, I should just be able to write {ShowList} (or whatever) somewhere in my article and have it display the list.

How can this be done?

WATYF

4

1 回答 1

0

您可以创建一个content包含现有功能的插件。内容插件只是查找一个字符串(例如{showlist})并将其替换为它定义的任何内容来替换它。

举个例子,看看里面的LoadModule内容插件/plugins/content/——特别是组成插件的两个文件。loadmodule.phploadmodule.xml

该插件查找{loadposition}响应onPrepareContent事件的字符串,并将其替换为分配给该位置的模块的输出。

您可以在Joomla!上阅读有关插件创建插件的信息!文档网站请注意,自 1.5 以来插件并没有太大变化,主要是事件名称发生了变化,但您可以检查核心 1.5 插件以了解这些详细信息。

于 2013-10-16T22:15:07.883 回答