【问题标题】:How to Get the "Link A" of an article in Joomla 3?如何在 Joomla 3 中获取文章的“链接 A”?
【发布时间】:2014-04-22 21:29:42
【问题描述】:

我想知道在面板中找到链接“链接A”或“链接B”以创建文章的代码是什么,也许你能启发我。

例如图片 http://goo.gl/v9jXU2

【问题讨论】:

  • 获取urls字段,然后json_decode。

标签: joomla geturl url-link


【解决方案1】:

在文章模型中有一个名为 getItem($pk) 的函数,其中 $pk 是文章 ID。

文件:components\com_content\models\article.php

通过传递文章 ID 调用此函数。这将返回所有文章相关数据。

结果您可以在 urls 变量中找到链接“链接 A”或“链接 B”,如下所示:

$result = $model->getItem($articleId);

$result->urls 包含与链接“链接 A”或“链接 B”相关的信息。 json_decode 这个数据并相应地使用。

【讨论】:

    猜你喜欢
    • 2013-05-15
    • 1970-01-01
    • 2015-12-19
    • 1970-01-01
    • 2014-04-13
    • 1970-01-01
    • 1970-01-01
    • 2014-12-15
    • 1970-01-01
    相关资源
    最近更新 更多