PHP code example of jelix / jtags-module

1. Go to this page and download the library: Download jelix/jtags-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jelix / jtags-module example snippets


$form = jForms::create('news', $id_news);

// ...

$srvTags = jClasses::getService("jtags~tags");
$tags = implode(',', $srvTags->getTagsBySubject('news', $id_news));
$form->setData('tags', $tags);

$resp = $this->getResponse('html');
//...
jClasses::getService("jtags~tags")->setResponsesHeaders($resp);

$id_news = $this->param('id_news');
$form = jForms::fill('news', $id_news);

// ...

$srvTags = jClasses::getService("jtags~tags");
$tags = explode(',', $form->getData('tags'));

$srvTags->saveTagsBySubject($tags, 'news', $id_news));


$srvTags = jClasses::getService("jtags~tags");
$tags = implode(', ', $srvTags->getTagsBySubject('news', $id_news));

$tpl->assign('tags', $tags);

$tpl->assignZone("tagscloud", "jtags~tagscloud", array('destination'=>'module~ctrl:method', 'maxcount'=>30));


$tag = $this->param("tag", false);
if ($tag) {
    $srv_tags = jClasses::getService("jtags~tags");
    $listOfNewsId = $srv_tags->getSubjectsByTags($tag, "news"));
}
bash
php dev.php module:configure jtags
bash
php install/installer.php

{zone "jtags~tagscloud", array('destination'=>'module~ctrl:method', 'maxcount'=>20)}