Feature requests: Freetag plugin

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Feature requests: Freetag plugin

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Feature requests: Freetag plugin

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Feature requests: Freetag plugin

Post 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
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

How should this userinterface look like? Checkboxes in the tagcloud? That doesn't look very smooth I think.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post 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.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post 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
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post 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.
Ciao, Stephan
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post 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
Post Reply