How to exclude tags from popular tags?
|
bognerart
![]()
Joined: 2007-05-05
Posts: 72 |
Posted: Sun, 2011-10-09 14:35
|
|
Is there a way to exclude some tags from popular tags, eg. all the tags were number of tags is equal to number of photos? __ Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32 |
|


Posts: 25945
Yes but it would require customizing the query or the view of the particular module that displays the tags. What module?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 72
I think it is the tag-module. THe number of tags can be customized at "Advanced settings" only.
__
Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32
Gallery: bognerart.eu
Posts: 25945
my test gallery does not have tags at this time so this is off the top of my head; try this:
modules/tag/views/teg_coude.html.php
<?php defined("SYSPATH") or die("No direct script access.") ?> <ul> <? foreach ($tags as $tag): ?> <? if ($tag->count < 10) : ?> <li class="size<?=(int)(($tag->count / $max_count) * 7) ?>"> <span><?= $tag->count ?> photos are tagged with </span> <a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a> </li> <? endif ?> <? endforeach ?> </ul>adjust the 10.
or you might be able to use something like $max_count - 1
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 72
Floridave, thanks and if you want a few photos for testing, you can download some at www.bognerart.eu or I can send you photos by mail for testing.
At the moment, I use this (default)
I don't understand, what this code does?
I don't want to exclude tags, which are less than 10, but the "top tags". Please have a quick look at my gallery, I don't want the tags mentioned, which are "big and bold". Tags are useless with the gallery, but not in other cases, which can be found in every photo, like my name ore "geotagged" (99.99% of all photos).
__
Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32
Gallery: bognerart.eu
Posts: 1633
I'm assuming that means you're not really a programmer. If that's the case, I recommend just trying it, seeing if it works for you. If it doesn't work for you, report back and let us know what it did that you didn't want it to do (or what it didn't do that you wanted it to do).
But, for what it's worth, it checks to see if the tag is used more than x number of times and, if so, it skips everything between the two bolded statements. In this case, x = 10, but you can change 10 to whatever you want.
Posts: 25945
I guess you need to explain what ' but the "top tags"." mean, I don't understand.
I see you have a couple of tags with over 4000 items
<span>4296 photos are tagged with </span> <a href="/index.php/tag/16/artmembers+salzburg">artmembers salzburg</a>So do you want to eliminate this tag from showing?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 72
Floridave, yes, you understand me. At the moment, there are 4531 photos, e.g. geotagged shows 4263 (I thought it are more), All tags with more than x photos should not be shown, where x sholud be a dynamic value, eg. 90% of all photos. I am unsure, if a constant value fits my needs too.
Sorry I could not try your suggestion till now, but when I read the code, I am unsure, if it does what I want.
__
Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32
Gallery: bognerart.eu
Posts: 25945
just change the 10 to 4262 and report back.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 72
Floridave, thanks, I played a little bit with the amount, 4262 does what I mean and I think 3000 too (which is configured at the moment). Is there a chance to use a dynamic value depending on all photos? Is there a way to change the font size of the tags?
__
Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32
Gallery: bognerart.eu
Posts: 25945
How are your math skills? there is 2 values that we give you $tag->count and $max_count.
You should be able to do some math given the $max_count and come up with some percentage as you suggested.
All done with css. since you are eliminating the larger tags then I suggest you look at the css that comes with the module:
#g-tag-cloud ul li.size0 a { color: #9cf; font-size: 70%; font-weight: 100; } #g-tag-cloud ul li.size1 a { color: #9cf; font-size: 80%; font-weight: 100;and adjust the font-size for each of the sizes ( 0 - 7 )
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 72
Thanks floridave, you should have asked about my php-skills ;-) I did some changes and watch if I can find the tags I want, when I add more photos.
__
Gallery 3.0.2 Coollanta - PHP 5.3.2 - Apache2 2.2.14 - Mysql 5.1.41 - Linux kernel 2.6.32
Gallery: bognerart.eu