以编程方式将文章添加到 Joomla
我对 Joomla 非常陌生(坦率地说,我刚刚开始探索使用 Joomla 的可能性),并且需要帮助以编程方式将文章添加到 Joomla 后端表(请参阅下面的详细信息)。同样,我想了解如何
- 列的值: parent_id
- lft
- rgt
- level
为表 jos_assets
(#__assets
) 生成 以及它们的值是什么功能角色(例如,它们是类似于唯一标识文件的操作系统索引节点的“指针/索引”,还是它们更具功能属性,例如标识类别、子类别等)
使用以下内容可能会有所帮助简化的例子来说明我正在尝试做的事情。假设我们有一个程序,它收集各种关键信息,例如网络文章作者的姓名、文章的主题类型、文章的日期以及文章的链接。我希望能够扩展这个程序,以编程方式将这些信息存储在 Joomla 中。目前,此信息存储在自定义表中,用户可以通过自定义 php 网页使用搜索条件(按作者姓名)在一定日期范围内查找感兴趣的文章。然后显示搜索结果以及指向实际文章的超链接。这些文章存储在本地网络服务器上,不是外部链接。存储在自定义表中的超链接部分包括物理文档的相对路径(相对于 Web 根目录),例如:
Author date type html_file
Tom 08-14-2011 WEB /tech/11200/ar_324.html
Jim 05-20-2010 IND /tech/42350/ar_985.html
等等。
与编写自定义 php 搜索和演示页面相比,Joomla 提供的所有优势以及趋势等,我们真的很想切换到它。似乎在其他表中,例如 #__assets
和 #__content
可以通过编程方式填充,以从我们现有的 php 程序(用于编译数据)填充 Joomla 以及然后使用Joomla。
非常感谢任何示例、建议和帮助
最诚挚的问候 加尔
I am very new to Joomla (frankly just started exploring the possibility of using Joomla) and need help with programmatically adding articles to Joomla backend tables (please see details below). Also along the same lines, I would like to understand how should values for the columns:
- parent_id
- lft
- rgt
- level
be generated for the table jos_assets
(#__assets
) and what is their functional role (eg are they “pointers/indexes” analogous to, say, an os inode to uniquely indentify a file or are they more functional attributes such as identifying the category, subcategory etc)
It might help to use the following SIMPLIFIED example to illustrate what I am trying to do. Say we have a program that collects various key information such as names of the authors of web articles, the subject type of the articles, the date of articles as well as a link to the article. I want to be able to extend this program to programmatically store this information in Joomla. Currently this information is stored in a custom table and the user, through a custom php web page, can use search criteria say by author name, over a certain range of dates to find the article(s) of interest. The result of this search is then displayed along with a hyperlink to the actual article. The articles are stored locally on the web server and are not external links. The portion of the hyperlink stored in the custom table includes the relative path of the physical document (relative to the web root), so for example:
Author date type html_file
Tom 08-14-2011 WEB /tech/11200/ar_324.html
Jim 05-20-2010 IND /tech/42350/ar_985.html
etc.
With all the advantages that Joomla offers over writing custom php search and presentation pages as well as trending etc, we would really like to switch to it. It seems that among other tables for example that #__assets
and #__content
can be populated programmatically to populate Joomla from our existing php program (which is used to compile the data) and then use Joomla.
Any examples, suggestions and help is greatly appreciated
Kindest regards
Gar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
初步说明:Joomla 1.6/1.7 非常相似。 1.5 没那么多。我假设 1.6/1.7,因为这是我推荐的新项目的基础。
首先,您需要能够访问 Joomla 框架。您可以通过组件、模块、引导它的 cron 或其他任何方式来完成此操作。我不会去想如何做到这一点。
但一旦你这样做了,创建一篇文章就相当简单了。
实际的字段列表会比该列表长一些(必填字段等),但您应该从 Joomla 框架中获得合理的错误消息等来说明这一点。
总之:
现在我想了一下,这可能会在 1.5 中起作用......
Just an initial note: Joomla 1.6/1.7 are pretty similar. 1.5 not so much. I'll assume 1.6/1.7, as that's what I'd recommend as a base for a new project.
First up, you'll need to be running with access to the Joomla framework. You could do this through a Component, or a module, or a cron that bootstraps it or whatever. I won't go though how to do that.
But once you do that, creating an article is reasonably simple.
The actual list of fields will be a bit longer than that (required fields etc), but you should get sane error messages etc from the Joomla framework which illuminate that.
So in summary:
Now that I think about it, that'll probably work in 1.5...
找到了一种更好的方法来做到这一点,没有任何错误 创建 Joomla!以编程方式文章
Found a better way to do this without any errors Create a Joomla! Article Programatically