简体   繁体   English

Joomla虚拟数据导入

[英]Joomla dummy data import

Recently I have started developing an extension for Joomla3 and I have a serious feeling that I'm missing something basic about the import feature. 最近,我开始开发Joomla3的扩展程序,我感到很严重,我缺少有关导入功能的一些基本知识。 I do know that it's possible to import some dummy data by using .sql files, but this works mainly for the custom created tables specific only for this extension. 我确实知道可以通过使用.sql文件来导入一些虚拟数据,但这主要适用于仅针对此扩展名的自定义创建的表。 But what if I want to insert some data in Joomla core tables like #__content, #__menu, $__modules ? 但是,如果我想在Joomla核心表中插入一些数据,例如#__ content,#__ menu和$ __ modules,该怎么办? That's still possible with using .sql files, but then I must be cautious not to overwrite something, not to create doubled entries, create relations with other tables and so on. 使用.sql文件仍然可以实现,但是我必须谨慎,不要覆盖某些内容,不要创建重复项,不要与其他表建立关系,等等。 That's quite complex process and prone to errors, in WordPress this feature is extremly simple and I think that Joomla also has such option, but I couldn't find it. 这是一个非常复杂的过程,并且容易出错,在WordPress中,此功能非常简单,我认为Joomla也具有这样的选项,但我找不到它。 I will be gratefull for any tips and tricks :) 我将不胜感激任何提示和技巧:)

Ok, it seems that I have found the solution thanks to the comment from Elin. 好的,似乎我已经找到了解决方案,这要归功于Elin的评论。 It's necessary to use JTable class in PHP code to add articles programmatically, source: https://zunostudios.com/blog/development/204-using-the-joomla-api-to-add-articles-programmatically 有必要在PHP代码中使用JTable类以编程方式添加文章,来源: https : //zunostudios.com/blog/development/204-using-the-joomla-api-to-add-articles-以编程方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM