Forums / Setup & design / Why tag cloud showing tags from ALL languages?

Why tag cloud showing tags from ALL languages?

Author Message

Olaf Fichtner

Sunday 02 May 2010 9:14:47 am

I am not sure if this is the right forum to ask, it appears I have a problem with the tag cloud, but I am not sure if this is a setting issue or a "feature"/bug. I came across eZ Publish because I need multiple languages and eZ Publish promised to be the way to go. After some exploration it seems however that the tag cloud is displaying tags from articles in all languages, which would not make much sense usually.

So I wonder, did I miss an important setting or is this indeed the actual/intended behaviour? I would very much prefer to only show tags belonging to articles in the currently selected language...

Robin Muilwijk

Sunday 02 May 2010 11:53:09 am

Hi Olaf,

That is a very good question, if this is a feature or perhaps a bug. I dug through some documentation and mainly this:

http://ez.no/doc/ez_publish/technical_manual/4_x/features/multi_language/configuring_the_site_languages

but could not find anything about the tag cloud and languages dependency. I'll try to contact some long time/experienced eZ users who might know more.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Matthieu Sévère

Sunday 02 May 2010 12:51:56 pm

Yes indeed, I already had this issue and reported it : http://issues.ez.no/15723

You can hack a little bit in going into the code and fetch the language of each tag to do some post processing :

$rs = $db->arrayQuery( "SELECT ezkeyword.keyword, count(*), ezcontentobject_attribute.language_code as keyword_count .......

Cheers !

--
eZ certified developer: http://ez.no/certification/verify/346216

Olaf Fichtner

Sunday 02 May 2010 8:00:42 pm

Thank you both for the replies! So at least it is not me, but indeed the tag cloud.

Matthieu, unfortunately I am better with human languages than with the computer-related ones. I will gnaw my way through PHP code and perhaps even some SQL if absolutely necessary, but I hope there can be an official solution - so at least I confirmed your bug report...

Roberto Antoniazzi

Monday 03 May 2010 6:18:51 am

I tried solving with a trick.. in the tpl eztagcloud.tpl I added the language among the parameters:

{def $language = ezini('RegionalSettings', 'Locale', 'site.ini')}

{eztagcloud( hash( 'parent_node_id', $block.custom_attributes.subtree_node_id, 'limit', 40, 'sort_by', array('count', false()), 'post_sort_by', 'keyword', 'language', $language ))}

Then in the file

extension/ezwebin/autoloads/eztagcloud.php

I added

if ( isset( $params['language'] ) )
{
$language = $params['language'];
$languageFilter2 = "AND ezcontentobject_attribute.language_code = " . "'" . $language . "'";
}
else
{
$languageFilter2 = "";
}

Finally I added the variable $languageFilter2 to

$rs = $db->arrayQuery(.....)

Robin Muilwijk

Monday 03 May 2010 11:41:49 am

Hi Roberto,

Does this code work? If so, it might help a lot to add it as a comment on the issue Matthieu reffers to. If the developers pick this up, they can then check your code and implement it, or at least use (part of) it.

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Olaf Fichtner

Monday 03 May 2010 11:44:14 pm

Hmm, where is eztagcloud.tpl located? I could not find it, and it seems neither could the computer...

Roberto Antoniazzi

Tuesday 04 May 2010 1:06:06 am

@Robin: I'll add the code as soon as possible

@Olaf: I was wrong.. the standard position of the template is extension/ezwebin/design/ezwebin/templates/node/view/tagcloud.tpl

Olaf Fichtner

Tuesday 04 May 2010 3:42:41 am

Roberto,

Sorry, did not work for me. I found two instances of tagcloud.tpl that looked suitable (node/view) and modified both. Your code for eztagcloud.php was inserted after

if ( isset( $params['offset'] ) )
$dbParams['offset'] = $params['offset'];

and the filter I put here:

$sqlPermissionChecking[where]
$languageFilter
$languageFilter2

I flushed all caches, but the tag cloud still shows tags from all languages... :-(

Did I perhaps make a mistake somewhere?

Olaf Fichtner

Monday 10 May 2010 10:32:33 am

I am not quite fluent in PHP, but Roberto's code should probably insert a line like

AND ezcontentobject_attribute.language_code = 'ger-DE'

into the query in eztagcloud.php. I have now manually added such line and played with a few language codes and this actually worked! So it looks like somewhere in the previous code (if isset...) the language code does not get inserted for some reason.

Does anyone know how to debug the file to find out where the problem lies? I enabled debugging in site.ini.append.php, but there is no output of PHP variables.

Roberto Antoniazzi

Monday 10 May 2010 11:59:55 am

Olaf, as I wrote in my first post you have to pass (and set) the variable

$language

in the template 

extension/ezwebin/design/ezwebin/templates/node/view/tagcloud.tpl

(or better in an override of this template) with the following code:

{def $language = ezini('RegionalSettings', 'Locale', 'site.ini')}

{eztagcloud( hash( 'parent_node_id', $block.custom_attributes.subtree_node_id, 'limit', 40, 'sort_by', array('count', false()), 'post_sort_by', 'keyword', 'language', $language ))}

roberto

Olaf Fichtner

Monday 10 May 2010 9:28:53 pm

I tried that, Roberto, I'm not sure where something may have gone haywire... Below is my current tagcloud.tpl. (I hope it displays OK, each time I pasted the copied code it appeared twice - but the file itself seems to be OK...)

<div class="border-box"><div class="border-tl"><div class="border-tr"><div class="border-tc"></div></div></div><div class="border-ml"><div class="border-mr"><div class="border-mc float-break">

<div class="content-view-tagcloud">

{def $language = ezini('RegionalSettings', 'Locale', 'site.ini')}

{eztagcloud( hash( 'parent_node_id', $block.custom_attributes.subtree_node_id, 'limit', 40, 'sort_by', array('count', false()), 'post_sort_by', 'keyword', 'language', $language ))}

</div>

</div></div></div><div class="border-bl"><div class="border-br"><div class="border-bc"></div></div></div></div>

Roberto Antoniazzi

Tuesday 11 May 2010 1:28:45 am

did you chose the right template? it should be

extension/ezwebin/design/ezwebin/templates/node/view/tagcloud.tpl

(or its override) and NOT

extension/ezwebin/design/ezwebin/templates/tagcloud/tagcloud.tpl

try to see if the right value is passed to the php code, for example adding:

print($params['language']); exit();

inside the file

extension/ezwebin/autoloads/eztagcloud.php

Olaf Fichtner

Tuesday 11 May 2010 10:37:21 am

I guess I admit defeat on this. I must have made a mistake, but I can not find it.

Roberto, I suppose your modification works for you, so do you think you could attach the two modified files to the bug report, as suggested by Robin? That would be really nice. I would download the files from there and try once more with those...

eZ debug

Timing: Jan 18 2025 05:14:08
Script start
Timing: Jan 18 2025 05:14:08
Module start 'content'
Timing: Jan 18 2025 05:14:09
Module end 'content'
Timing: Jan 18 2025 05:14:09
Script end

Main resources:

Total runtime1.0562 sec
Peak memory usage4,096.0000 KB
Database Queries232

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 589.2734180.8125
Module start 'content' 0.00860.9064 770.0859781.1406
Module end 'content' 0.91510.1410 1,551.2266353.3047
Script end 1.0560  1,904.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4195210.0002
Check MTime0.00170.1633210.0001
Mysql Total
Database connection0.00140.131310.0014
Mysqli_queries0.947489.70082320.0041
Looping result0.00280.26142300.0000
Template Total1.025297.120.5126
Template load0.00220.208220.0011
Template processing1.023096.856620.5115
Template load and register function0.00030.024310.0003
states
state_id_array0.00160.150310.0016
state_identifier_array0.00070.068120.0004
Override
Cache load0.00210.19941190.0000
Sytem overhead
Fetch class attribute can translate value0.00190.175350.0004
Fetch class attribute name0.00260.2482160.0002
XML
Image XML parsing0.00180.170850.0004
class_abstraction
Instantiating content class attribute0.00000.0042170.0000
General
dbfile0.00250.2336350.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
14content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
33content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
24content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 88
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs