Making the most out of tags

Hi! I've been playing around with the new release, impressive work guys! The new version has put me in the mood to rework Effervescence. I'm very excited about the implementation of tags but it's hard for me to tell what can be done with them in their current state. Calling `printTags` simply produces a list of tags but it seems there should be a function that calls tags each linked to a page with the search results for that tag. On that topic, it seems like you should be able to link to search results. At the moment, the URL bar for any given search appears as: `domain.com/index.php?p=search`.

Is there a way to permalink to search results? I would also like to see the images tagged with a particular term appear as an album with a cruft-free URL like `domain.com/tags/hawaii`. It would be brilliant to be able to narrow that down to `domain.com/tags/hawaii+panorama` as well.

Comments

  • printTagsAs() is the function you would be interested in. You can print them as a list or cloud. The default theme uses the cloud on the archive page. Both of these output views link to the search page like you want.
  • The printTagsAs() function doesn't exist (it should!), but printAllTagsAs() does. Incidentally, that function doesn't seem to return anything on my installation.
  • Stephane:

    PrintAllTagsAs() emits the html for the tags.

    You can create a sort of album if you want. the URL would be ..../page/search?words=hawaii

    You might be able to create a mod_rewrite rule that does this. If you get it to work, let us know what you did. Otherwise, put a ticket into the trac for the feature.
  • <?php printAllTagsAs('cloud', 'tags'); ?> is what we are using to print a tag cloud in the default theme
  • That didn't work for me on the image page but this does:

    <?php printTags('links', 'Tags: '); ?>

    The function to do that was built in to he printTags function using the $option variable to add the link tags. This way you get a linked list of tags but not a cloud (I didn't want a cloud there, just a list).

    Would PrintAllTagsAs be for all tags in the gallery whereas printTags is the tags for a specific image? That seems to make sense from what I can see (with my limited PHP skills...). The PrintAllTagsAs function also has a 'list' option, which would give you what I wanted above (linked list, not a cloud) for all tags.
  • What I printed before can go on an album, index or archive page. You are correct that printTags() is limited to the image and album pages. Tags were one of the last things we got put into 1.1 so more work is needed on displaying and updating them but we mostly wanted to get it to the point where people could at least start adding them and all of the display options were kind of a last minute bonus acrylian cooked up.
  • trisweb Administrator
    Just to go back to what Stephane was saying, I think `domain.com/tags/hawaii` and `domain.com/tags/hawaii+panorama` are very cool ideas - and not terribly difficult. I especially like combining tags with some delimiter; a plus works well since it signifies a space in a URL.

    We need to move to 1) A 'get' (URL string) method for Search, and 2) A specific tag-only listing function or page, so `domain.com/tags/hawaii` only contains things tagged 'hawaii' and not things with 'hawaii' in the description as well.

    Following that, the rewrite rules to make those permalinks happen will be easy.

    We also need to refactor the database schema for tags to make listing by tag more plausible, but that's also not hard.
  • Tristan, I agree, a tags.php page could be useful and have a different purpose from search.php.

    I really like the way Metafilter handles tags. For instance if you go to the photography tag you can quickly find cross-references with other topics by clicking on the '+' next to them.

    I don't have the PHP skillz to code this kind of stuff, but a powerful system for tags and searching EXIF would make zenphoto very hard to compete with.
  • Tristan and Stephane, I agree, it would be really sweet to see a tags link. Right now Zenphoto gets all the tags from my photos thru IPTC Keywords and puts them into tags, which is great. The thing is that I've only put people in these keywords. Because I had an idea that I would make the kind of links that we are talking about here. For example, I would go to one person and get all photos with this person in the tag field only, but right now I have to do a search and then I won't be able to use the next/prev links when browsing one of those photos. Because I want to be able to browse only the photos of this tagged person, like a seperate album.

    Being able to use this: domain.com/tags/hawaii would be great.
    And flip thru only the photos in that tag like an seperate album would also be great.
  • dinc to get a list of all your tags as links do this, printAllTagsAs('links')
  • aitf311:
    Yes I using that right now, but thats not what I was looking for. I would like to be able to go thru the search results as I would in an ordinary album, with the next/prev links.

    "2) A specific tag-only listing function or page, so domain.com/tags/hawaii only contains things tagged 'hawaii' and not things with 'hawaii' in the description as well."
    That is a great idea!
  • trisweb Administrator
    Dinc, I got you. That is definitely a necessary feature to make tags really useful as your example showed.

    Basically, we want to be able to define an "album" that is a group of search criteria (whether it be keywords, tags, or combinations) and then be able to use next/prev to browse it.

    This still requires refinements in the tag database schema to make it work faster and easier, those will come in 1.2. For now the simple tag model will have to work, but at least it's there in some form!
  • Some tag improvements will be in tonights build if anyone wants to check it out. printAllTagsAs('cloud') and printAllTagsAs('links') will both only search the tags now, no more searching the title/description
  • Does anyone have any code that would help me get started creating a tags.php page?
  • acrylian Administrator, Developer
    What excatly should that page do?
  • mydomain.com/tags would be a great idea. But please make an option to search just the tags or also the title / description. Because i often have tags in my title that dont appear in the tags again and it would be great to list those images too.
  • acrylian Administrator, Developer
    @picture-pete: You are new to Zenphoto, aren't you? You have already the option where to search on the admin options and you also can set that for each dynamic album.
Sign In or Register to comment.