Page 1 of 1

Feature requests: Freetag plugin

Posted: Tue Aug 28, 2007 10:10 pm
by yellowled
We already have the possibility to show entries tagged with a certain tag. What I'd love to see (if it's doable without too much of a hassle) in a future version is the possibility to combine (related) tags like i.e. on del.icio.us.

Example: http://<URL>/plugin/tag/<TAG> gives me a list of entries tagged with <TAG> and a list of related tags. It would be great it any tag in that list would also have a "+" in front, so I or visitors could see http://<URL>/plugin/tag/<TAG1>+<TAG2>.

YL

Re: Feature requests: Freetag plugin

Posted: Wed Aug 29, 2007 10:51 am
by garvinhicking
Hi!

Try http://URL/plugin/tag/TAG1/TAG2/TAG3 that should work.

Regards,
Garvin

Re: Feature requests: Freetag plugin

Posted: Wed Aug 29, 2007 12:27 pm
by yellowled
garvinhicking wrote:Try http://URL/plugin/tag/TAG1/TAG2/TAG3 that should work.
Yes, it does. But there's no, uhm, user interface to do that as far as I can see. And I think there should be, especially if the functionality basically already exists :)

YL

Posted: Wed Aug 29, 2007 12:39 pm
by blog.brockha.us
How should this userinterface look like? Checkboxes in the tagcloud? That doesn't look very smooth I think.

Posted: Wed Aug 29, 2007 12:51 pm
by mattsches
It could be done using a little JavaScript magic, I guess :wink: However, I'm not sure it's really worth the effort (no, I'm not going to post a poll). If I got waaay to much time on my hands someday, maybe I will make an attempt at it.

Posted: Wed Aug 29, 2007 12:57 pm
by yellowled
blog.brockha.us wrote:How should this userinterface look like? Checkboxes in the tagcloud? That doesn't look very smooth I think.
I still like the del.icio.us look. That way, the related tags cloud would look like this:

Code: Select all

+ TAG1 + TAG2 + TAG3 etc.
Clicking TAG1 switches to articles tagged with TAG1 (only), clicking the + in front of it combines TAG1 and the currently displayed TAG.

Let's say we're on http://URL/plugin/tag/TAG0/, looking at the list of related tags. Clicking TAG1 means: switch to http://URL/plugin/tag/TAG1/, clicking + in front of it means: switch to http://URL/plugin/tag/TAG0/TAG1/.

YL

Posted: Wed Aug 29, 2007 1:03 pm
by garvinhicking
Hi!
Clicking TAG1 switches to articles tagged with TAG1 (only), clicking the + in front of it combines TAG1 and the currently displayed TAG.
That would only work with javascript...which I sort of dislike. Isn't there some other way for an interface to combine tags?

Regards,
Garvin

Posted: Wed Aug 29, 2007 3:39 pm
by mattsches
If I understand yellowled right (I haven't checked how del.icio.us do it), it could be done without JavaScript, simply by altering the hrefs of the tags' links. It would look something like this (I left the unnecessary parts out) if we're on http://URL/plugin/tag/TAG0/:[code]<div><a href="http://URL/plugin/tag/TAG0/TAG1/">+</a><a href="http://URL/plugin/tag/TAG1/">TAG1</a>...</div>[/code]
Should be easy, just some rewriting of $taglink in the foreach loop. Or did I miss something here?

Meanwhile, I also tried to come up with a JavaScript solution because it looked so dead simple to me. And it was. If anyone wants to try it: You need to include jQuery (e.g. via my new plugin), and then simply add the following lines to the bottom of function generate_content() in the serendipity_plugin_freetag.php file (I know this can be optimized, but hey, it's a quick hack).

Code: Select all

        ?>
        <script type="text/javascript">
        var tagcollection = '';
        $(document).ready(function(){
            $('div.container_serendipity_plugin_freetag a[@rel*=tag]').click(function() {
                tagcollection = tagcollection + $(this).text() + '/';
                $(this).css('color','red');
                return false;
            });
            $('a#multitagsearch').click(function(){
                var orig = $(this).attr('href');
                $(this).attr('href', orig + encodeURI(tagcollection));
            });
        });
        </script>
        <?
        if ($taglink == null) {
            $taglink = $this->get_config('taglink');
        }
        echo '<a href="' . $taglink . '" id="multitagsearch">GO!</a>';

However, I share Garvin's reluctance to include this JavaScript based solution in the freetag plugin. It's just that I'm still so impressed by how simple it is to achieve cool features by adding just a few lines of JavaScript code.

- Mattsches

Posted: Wed Aug 29, 2007 10:20 pm
by stm999999999
hm, I would like to see this feature, realy!

But on my blog http://blog.stephan.manske-net.de/plugin/tag/blog/s9y gives me articles with tag blog AND articles with tag s9y (in other words: more articles)

Would it be a better idea to narrow the output? = only articles with blog AND s9y as tag.

Posted: Thu Aug 30, 2007 1:43 am
by yellowled
stm999999999 wrote:But on my blog http://blog.stephan.manske-net.de/plugin/tag/blog/s9y gives me articles with tag blog AND articles with tag s9y (in other words: more articles)

Would it be a better idea to narrow the output? = only articles with blog AND s9y as tag.
Whoa. How about both of them? :) (I'm sure some of you are now pulling their hair out :twisted:) We could i.e. have || for "TAG0 or TAG1" and && for "TAG0 and TAG1" ... (yay, finally my limited Perl knowledge is of any use at all!)

YL