Il y a quelques temps, Arnaud avait démarré une discussion sur l'intégration de Jcomments dans SP Simple PortFolio : https://forum.joomla.fr/showthread.p...icle-de-joomla
SP Simple Portfolio version 1.4 (https://www.joomshaper.com/joomla-ex...mple-portfolio) a évolué en simplifiant, en autre, le nom de spsimpleportfolio_item_id qui devient id.
Pour intégrer JComments dans la version 1.4 de SP Simple Portfolio, il faut donc procéder comme suit:
1. copier le fichier default.php du répertoire components/com_spsimpleportfolio/views/item/tmpl vers le répertoire <mon template>/html/com_spsimpleportfolio/item
2. après la ligne 12 du fichier default.php, il faut ajouter:
3. en fin du fichier default.php, il faut ajouter juste avant le dernier </div>:
4. créer un fichier com_spsimpleportfolio.plugin.php dans le répertoire components\com_jcomments\plugins. Ce fichier doit contenir:
Remarque: nous avons eu cette semaine plusieurs discussions attirant l'attention sur le fait que JComments semble ne plus être maintenu (https://forum.joomla.fr/showthread.p...light=jcomment)
Pascal
SP Simple Portfolio version 1.4 (https://www.joomshaper.com/joomla-ex...mple-portfolio) a évolué en simplifiant, en autre, le nom de spsimpleportfolio_item_id qui devient id.
Pour intégrer JComments dans la version 1.4 de SP Simple Portfolio, il faut donc procéder comme suit:
1. copier le fichier default.php du répertoire components/com_spsimpleportfolio/views/item/tmpl vers le répertoire <mon template>/html/com_spsimpleportfolio/item
2. après la ligne 12 du fichier default.php, il faut ajouter:
Code:
$comments = 'components/com_jcomments/jcomments.php';
if (JFile::exists($comments)) {
require_once(JPATH_SITE .'/'.$comments);
}
Code:
<?php
echo JComments::showComments($this->item->id, 'com_spsimpleportfolio', $this->item->title);
?>
Code:
<?php
/**
* JComments plugin for SP SimplePortfolio
*/
defined('_JEXEC') or die;
class jc_com_spsimpleportfolio extends JCommentsPlugin
{
function getObjectInfo($id, $language)
{
$info = new JCommentsObjectInfo();
$_Itemid = self::getItemid('com_spsimpleportfolio');
$link = 'index.php?option=com_spsimpleportfolio&id=' . $id . '&view=item';
$link .= ($_Itemid > 0) ? ('&Itemid=' . $_Itemid) : '';
$link = JRoute::_($link);
$db = JFactory::getDbo();
$db->setQuery( 'SELECT title,access FROM #__spsimpleportfolio_items WHERE id = ' . $id );
$row = $db->loadObject();
if (!empty($row)) {
$info->title = $row->title;
$info->access = $row->access;
$info->link = $link;
$info->userid = 0;
}
return $info;
}
}
Pascal






Commentaire