separating and eliminating tag_id

1. how does it make single tag_id ??
2. how to eliminate one tag in the tag list,
example:
tag: A, B, C, D
into A, B, C without D

because I wanted to separate them from the list some tag_id
sorry i use google translate, hopefully understood.

Please help....
thank you

Réponses

  • kowalskykowalsky Member
    janvier 2016 modifié
    Hello sondang82,

    I am not aware that it is possible to display or not display a specific tag from the tag list (looks like there is no tagId like artId or catId). Unlike for the category settings, tags are not editable and have no admin page to manage them. This is maybe a request to adress to Stephane (PluXml core manager).


    However, if you currently have only 4 tags (A, B, C and D) and want to display only "A, B, C", you can use a trick available from function tagList <?php $plxShow->tagList('$format',$max,$order) ?> as it is allowing you to set a maximum number of tags to display ($max) and also to sort them in alphabetic order. In this case $max should be "3" and order should be "alpha", then tag list will only display tags A,B and C (because they are the 3 first alpha ordered tags). Of course this trick will not work if you want to not display tag C instead of tag D.

    (if you are not familiar with french or english, perhaps some of us do speak your mothertongue)
  • hello Kowalsky
    thank you for the answer.

    I hope in the future there is to organize tags. I use because it is easy and powerful pluxml create websites without database.

    I think direct use links like
    <? php $ plxShow-> UrlRewrite ()?>tags/truck
    but the number of the tag does not appear.

    I am from Indonesia.

    sorry i use google translate again.

    thank you
  • StéphaneStéphane Member, Former PluXml Project Manager
    Hi and welcome sondang82

    It's a little bit more complex for displaying the number of tags

    Try this function by adding it in the plxShow class (/core/lib/class.plx.show.php)
    	/**
    	 * Méthode qui affiche le lien d'un tag particulier
    	 *
    	 * @param	format	format du texte pour chaque tag (variable : #tag_id, #tag_count, #tag_item, #tag_url, #tag_name, #nb_art, #tag_status)
    	 * @return	stdout
    	 * @scope	global
    	 * @author	Stephane F	
    	*/
    	public function tagLink($pTag, $format='<a class="#tag_size #tag_status" href="#tag_url" title="#tag_name">#tag_name</a>') {
    		if($this->plxMotor->aTags) {
    			$datetime = date('YmdHi');
    			$array=array();
    			foreach($this->plxMotor->aTags as $idart => $tag) {
    				if(isset($this->plxMotor->activeArts[$idart]) AND $tag['date']<=$datetime AND $tag['active']) {
    					if($tags = array_map('trim', explode(',', $tag['tags']))) {
    						foreach($tags as $tag) {
    							if($tag!='') {
    								$t = plxUtils::title2url($tag);
    								if(!isset($array[$t])) {
    									$array[$t]=array('name'=>$tag,'url'=>$t,'count'=>1);
    								}
    								else
    									$array[$t]['count']++;
    							}
    						}
    					}
    				}
    			}
    			$t = plxUtils::title2url($pTag);
    			if(isset($array[$t])) {
    				$tag = $array[$t];
    				$name = str_replace('#tag_id','tag-'.$size++,$format);
    				$name = str_replace('#tag_count',$tag['count'],$name);
    				$name = str_replace('#tag_item',$tag['url'],$name);
    				$name = str_replace('#tag_url',$this->plxMotor->urlRewrite('?tag/'.$tag['url']),$name);
    				$name = str_replace('#tag_name',plxUtils::strCheck($tag['name']),$name);
    				$name = str_replace('#nb_art',$tag['count'],$name);
    				$name = str_replace('#tag_status',(($this->plxMotor->mode=='tags' AND $this->plxMotor->cible==$tag['url'])?'active':'noactive'), $name);
    				echo $name;
    			}
    		}
    	}
    

    Use this calling in frontend by editing sidebar.php for instance.
    	<?php $plxShow->tagLink('My tag') ?>
    

    First argument is the tag name you want to display with his link. As usual in PluXml, displaying can be formated with the 2nd parameter. Use these variables:
    #tag_id, #tag_count, #tag_item, #tag_url, #tag_name, #nb_art, #tag_status

    For example:
    	<?php $plxShow->tagLink('My tag', '<a class="#tag_size #tag_status" href="#tag_url" title="#tag_name">#tag_name</a>') ?>
    

    Hope this helps.

    ps: Don't forget changes will be lost after an upgrade of PluXml if plxShow is modified.

    Consultant PluXml

    Ancien responsable du projet (2010 à 2018)

  • Thanks Stéphane
    eventually could work well.

    I hope in the future more such variants tag category.

    Once again, thank you
Connectez-vous ou Inscrivez-vous pour répondre.