- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我试图在 joomla 的另一个模块中显示文章图像和描述。它喜欢 wordpress 帖子。
这里我想显示产品名称、图片和描述。所以我把标题作为产品名称,现在我想把 introtext 分成两部分,作为文章的图像和描述。
我为每个类别 id = 9 的产品发布了帖子。
这是我使用的代码
<?php
catID = 9;
//echo $catID;
$doc = JFactory::getDocument();
$page_title = $doc->getTitle();
$db = JFactory::getDBO();
$db->setQuery("SELECT title, introtext FROM #__content WHERE catid = ".$catID);
$articles = $db->loadObjectList(); ?>
<div class="row">
<div class="col-md-12">
<div class="col-md-4">
<div class="nopadding">
<?php foreach($articles as $article){
$title = $article->title;?>
<!-- Image -->
<!-- Description -->
<img class="ras-img" src=""><!-- Image should add here -->
<div class="ras-hvr">
<div class="ras-inner-hvr">
<div class="row">
<div class="col-md-6 pro-name"><?php echo $article->title; ?></div>
</div>
<div class="row">
<div class="col-md-12 pro-des"><!-- Description here --></div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
谁能帮我解决这个问题?
最佳答案
查看 components\com_content\views\article\tmpl\default.php
在顶部附近,您会看到这行代码来设置 $images
。
$images = json_decode($this->item->images);
再往下,您将看到图像是如何显示的:
<?php if (isset($images->image_fulltext) && !empty($images->image_fulltext)) : ?>
<?php $imgfloat = (empty($images->float_fulltext)) ? $params->get('float_fulltext') : $images->float_fulltext; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
<?php if ($images->image_fulltext_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_fulltext_caption) . '"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>"/> </div>
<?php endif; ?>
描述:
$title = $article->introtext; and/or $title = $article->fulltext;
现在,有了这些信息,您需要创建一个模板覆盖,这样您就不会破解核心安装文件。参见 How to override the output from the Joomla! core有关详细信息,但本质上,您可以使用模板执行此操作(我将使用 beez3 作为示例):
\templates\beez3\html\com_content\article
\components\com_content\views\article\tmpl\default.php
关于php - 如何在模块joomla中分别显示文章的描述和图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26696373/
hello world tutorial对于 Joomla 状态: $mainframe is a global variable in Joomla that has lots of useful
我已经通过了:http://docs.joomla.org/How_to_add_breadcrumbs 和 http://api.joomla.org/Joomla-Framework/Applic
在为模块设置添加参数字段时,我正在寻找可能的过滤器列表。 我知道 Text form field type 的示例中存在 filter="raw"和 filter="integer". 但是这些字段的
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 5年前关闭。 Improve this questi
是否可以为 Joomla 1.5 后端和前端实现单点登录。我发现当管理员例如在后端登录并且需要在前端执行一些用户功能时必须再次登录,这有点多余。有没有实现单点登录的方法? 最佳答案 乔姆拉!被实现为两
我们如何在 joomla 中渲染带有标题的模块。因为现在,我可以根据位置渲染模块,但它不包括模块标题。 这是我渲染模块的方式。 title); echo JModuleHelper::renderMo
我正在 joomla 中开发一个自定义搜索模块。所以我正在使用 joomla 的内置数据库连接和功能。 问题是我想在这个模块中使用分页类,但不知道任何提示。 请帮我解决这个问题。 谢谢。 最佳答案 第
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 10年前关闭。 Improve this qu
我在joomla中使用youtube视频,其中代码如下:- [jv_youtube url="https://www.youtube.com/watch?v=8Di0IOQssOM&rel=0" wi
我使用 onContentPrepare 事件将此 [test] 更改为其他文本 o prinf html,如 wordpress 短代码,但没有任何变化。 出了什么问题? 这是shortcodejd
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
请先转到www.espacioasir.com,然后注意第二篇文章如何“压碎”到左侧-文章正常宽度的一半。 无论如何,我认为我无法解释得更多,我的问题很清楚:为什么会这样?我确实想提及一下,本文的内容
有些人可能知道,Wordpress 在设置中有一个选项,允许在子目录中安装站点,同时将站点 URL 设为主域。它类似于“站点 url”和“Wordpress url”。我在 Joomla 中寻找类似的
我遇到的这种情况:安装了 joomlaxy/JSPT/Payplans 的 joomla 运行良好。 现在,我在/pages 文件夹中做了一个小的 php 脚本,用于在特定用户类型的模板中使用,它调用
我知道如何为 Joomla 1.6 创建一个模块。但是我听说可以在同一个 XML 安装文件中添加一组 Joomla 1.5 参数和一组 Joomla 1.6 参数,以使只有一个包与 1.6 和 1.5
自从昨晚 Joomla 3.0 Alpha 发布以来,我想尝试开始将我编写的 Joomla 2.5 组件转换为新的 Joomla 3.0。我一直在关注所有的开发小组,他们说 JController、J
我在 Joomla 1.5 中工作并开发了一个组件,该组件有 2 个 View ,在两个 View 中具有相同的部分。我正在重复代码,因为我在 2 个不同的 View 中使用了相同的代码。所以我想知道
我正在构建一个自定义 Joomla 组件,并将其添加到我的模板 (default.php) 文件(它使用 HTTP POST)中的表单中: echo JHTML::_( 'form.token' );
拿起 Joomla 的最快方法是什么?书籍,培训等?我们希望在 Joomla 中培训 10 名中高级 Java 开发人员。 最佳答案 如果你想节省时间,不要从官方的 joomla 文档开始。转至 ht
我之前以这种方式从 Joomla 文章中添加了 Joomla 模块:{loadmodule mod_name}但是这次我需要从中传递参数。 如何将文章中的参数传递给 Joomla 模块? 最佳答案 您
我是一名优秀的程序员,十分优秀!