HomePage › Forums › Templates Support › eduLearn › Display Plugin courses_format variables on Category layout
- This topic has 0 replies, 1 voice, and was last updated 4 years, 10 months ago by
ewadrel.
-
AuthorPosts
-
April 4, 2018 at 5:14 pm #3508
ewadrel
ParticipantHello,
i have a question on Edulearn template.
I want to display on a specific LAYOUT templates\edulearn\html\com_content\category\blog2.php , the variables used via your Plugin courses_format ($courses_location, $courses_duration…).
Here is my php file if you can help me please. Look line #105 and #109, I’m displaying <?php echo $params->get(‘courses_location’) ;?> but the variable is EMPTY.<?php /** * @package Joomla.Site * @subpackage com_content * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); JHtml::_('behavior.caption'); ?> <div class="blog<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="http://schema.org/Blog"> <?php $introcount = (count($this->intro_items)); $counter = 0; ?> <?php if (!empty($this->intro_items)) : ?> <?php foreach ($this->intro_items as $key => &$item) : ?> <?php $rowcount = ((int) $key % (int) $this->columns) + 1; ?> <?php if ($rowcount == 1) : ?> <?php $row = $counter / $this->columns; ?> <div class="items-row <?php echo 'row-' . $row; ?> row clearfix"> <?php endif; ?> <div class="col-sm-<?php echo round((12 / $this->columns)); ?>"> <article class="blog_grid_item column-<?php echo $rowcount; ?><?php echo $item->state == 0 ? ' system-unpublished' : null; ?><?php echo $item->featured ? ' item-featured' : ''; ?>" itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting"> <?php $this->item = & $item; $post_attribs = new JRegistry(json_decode( $this->item->attribs )); $post_format = $this->item->params->get( 'post_format', '' ); $author = ( $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author ); $attribs1 = json_decode($this->item->attribs); $images = json_decode($this->item->images); if(isset($attribs1->spfeatured_image) && $attribs1->spfeatured_image != '') { $full_image = $attribs1->spfeatured_image; } elseif(isset($images->image_intro) && !empty($images->image_intro)) { $full_image = $images->image_intro; } $commentsAPI = JPATH_SITE . '/components/com_jcomments/jcomments.php'; if (file_exists($commentsAPI)) { require_once($commentsAPI); $count = JComments::getCommentsCount($item->id, 'com_content'); } $params = $this->item->params; $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); ?> <div class="entry_image"> <a href="<?php echo $link; ?>"><img class="img-responsive" src="<?php echo JURI::root().$full_image;?>" alt="<?php echo $this->item->title; ?>"></a> <div class="reviews"> <div class="row"> <div class="col-sm-6"> <div class="item_meta"> <?php $author = ($item->created_by_alias ? $item->created_by_alias : $item->author); //echo $author; ?> </div> </div> <div class="col-sm-6 tRight"> <div class="item_meta"> <?php //echo $count;?> </div> <div class="item_meta"> <?php //echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC5')); ?> </div> </div> </div> </div> <div class="link_more"> <a href="<?php echo $link; ?>"><?php echo JText::_('VIEW_DETAIL');?></a> </div> </div> <div class="article-title-wrapper"> <h4><a class="article-title" href="<?php echo $link; ?>"><?php echo $item->title; ?></a></h4> <p><?php echo $item->introtext; ?></p> <div class="article_info vs_clear"> <?php //********************** // Get plugin 'my_plugin' of plugin type 'my_plugin_type' $plugin = JPluginHelper::getPlugin('system', 'courses_format'); // Check if plugin is enabled if ($plugin) { // Get plugin params $pluginParams = new JRegistry($plugin->params); $courses_location = $pluginParams->get('courses_location'); $courses_duration = $pluginParams->get('courses_duration'); //$param3 = $pluginParams->get('param3'); } //********************** //if($id_teacher) {?> <div class="fleft"> <strong><i class="fa fa-map-marker"></i>to<?php echo $params->get('courses_location') ;?>ti<?php echo $courses_location ;?>ta<?php //echo $teacher->title;?></strong> </div> <?php //}?> <div class="fleft"> <strong><i class="fa fa-clock-o"></i><?php echo $params->get('courses_duration');?></strong> </div> </div> </div> </article> <!-- end item --> <?php $counter++; ?> </div><!-- end col-sm-* --> <?php if (($rowcount == $this->columns) or ($counter == $introcount)) : ?> </div><!-- end row --> <?php endif; ?> <?php endforeach; ?> <?php endif; ?> </div>
Here is what I got so far :
that I could call the variables of a plugin anywhere in Joomla but it doesn’t work. I have adapated the code but it doesn’t work.
//**********************
// Get plugin 'my_plugin' of plugin type 'my_plugin_type' $plugin = JPluginHelper::getPlugin('system', 'courses_format'); // Check if plugin is enabled if ($plugin) { // Get plugin params $pluginParams = new JRegistry($plugin->params); $courses_location = $pluginParams->get('courses_location'); $courses_duration = $pluginParams->get('courses_duration'); //$param3 = $pluginParams->get('param3'); }
//**********************
Thank you for your input.
Philippe from France
-
AuthorPosts
You must be logged in to reply to this topic.