繁体   English   中英

Joomla模块未获取参数

[英]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.

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