[英]Joomla module do not get the parameter
我有一個模塊,我想在“標題”中添加“ short_description”。 我添加了參數,但是它不起作用。 我做錯了什么? 正確位置的模塊
模塊代碼:
<?php
/**
* @package SP LMS
* @subpackage mod_splmscourses
*
* @copyright Copyright (C) 2010 - 2015 JoomShaper. All rights reserved.
* @license GNU General Public License version 2 or later.
*/
defined('_JEXEC') or die;
jimport( 'joomla.filesystem.file' );
//Joomla Component Helper & Get LMS Params
jimport('joomla.application.component.helper');
$splmsparams = JComponentHelper::getParams('com_splms');
//Get Currency
$currency = explode(':', $splmsparams->get('currency', 'USD:$'));
$currency = $currency[1];
// Get image thumb
$thumb_size = strtolower($splmsparams->get('course_thumbnail_small', '100X60'));
?>
<div class="mod-splms-courses <?php echo $moduleclass_sfx; ?>">
<ul class="splms-courses-list">
<?php foreach ($items as $item) { ?>
<?php $item->price = ($item->price == 0) ? JText::_('MOD_SPLMS_COURSES_FREE') : JText::_($currency) . $item->price; ?>
<?php $item->short_description; ?>
<li class="mod-splms-course clearfix">
<a href="<?php echo $item->url; ?>">
<?php
$filename = basename($item->image);
$path = JPATH_BASE .'/'. dirname($item->image) . '/thumbs/' . JFile::stripExt($filename) . '_' . $thumb_size . '.' . JFile::getExt($filename);
$src = JURI::base(true) . '/' . dirname($item->image) . '/thumbs/' . JFile::stripExt($filename) . '_' . $thumb_size . '.' . JFile::getExt($filename);
if(JFile::exists($path)) {
$thumb = $src;
} else {
$thumb = $item->image;
}
?>
<a href="<?php echo $item->url; ?>">
<img src="<?php echo $thumb; ?>" class="splms-course-img splms-img-responsive" alt="<?php echo $item->title; ?>">
</a>
</a>
<strong class="splms-course-title">
<a href="<?php echo $item->url; ?>" class="splms-course-title"><?php echo $item->title; ?></a>
<p>
<?php echo $item->price; ?>
<?php echo $item->short_description; ?>
</p>
</strong>
</li>
<?php } ?>
</ul>
</div>
<?php
我在兩個地方只添加了一行:“ <?php echo $item->short_description; ?>
”在<ul>
一行在<p>
一行
如果已將short_description添加為參數(在模塊的xml文件中),則可以使用以下命令進行檢索: $params->get('short_description','');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.