如何正确扩展 joomla?

How to properly extend joomla?

我正在尝试扩展 joomla 3,但我不知道如何正确地进行。我需要的是数据库中的一些新表,到目前为止它们是完整的,但我使用了 joomla 本身的另一个前缀来防止冲突。现在我想制作一个界面,访客可以在其中浏览和过滤数据,还可以让管理员插入新数据的选项,这些数据需要语义连接,所以我不能使用查询生成器。有什么好的做法可以解决这样的问题吗?我开始编写一个模块,但写到一半时它似乎并不是完成这一切的最佳解决方案。

写一个component应该比写一个模块更适合你的任务,因为在那里你可以控制cms的主要内容。

来自 Joomla 文档:

Modules are only "small boxes" arranged around components.

A component is a kind of Joomla! extension. Components are the main functional units of Joomla!;

请参阅 Joomla 教程 Developing a MVC Component/Developing a Basic Component

完成该任务的一种更简单但不太干净的方法是 write a plugin. For example you could write one to modify the article's behavior and inject your own content into an article before it is displayed to the user, see the onContentBeforeDisplay event

编程的替代方法是使用内容构建工具包 (CCK),这是您只需在 Joomla 中安装的强大扩展。您可以创建新的内容类型,也可以从数据库中注入数据。 例如,我创建了一个新类型 "publication",其中包含标题、作者、描述...字段,并使用该类型来显示我的自定义数据库的内容。 我用了 Seblod for that, but there are others too. I think the most popular is K2.

听起来您应该研究 component 开发。

模块通常只关心数据的显示,能够向单个数据库字段添加少量参数,而组件允许您创建多个视图,因此可以使用任何数据库行和你想要的表。

有时您需要一个组件和一个模块,该模块用于向站点用户显示组件数据。组件取代了主要的文章区域,但模块用于较小的小部件区域。

在学习方面,您最好从模块开发开始,因为组件是建立在这些知识之上的。