Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Use of txp:image_index and txp:image_display tags
thebombsite wrote:
There’s probably a post in the archives somewhere announcing their arrival.
Aha! Gamma 1.15 was when the tags crept in, but it seems they were written for clean URLs so it looks like I was wrong with my guess.
maybe a bit of updating wouldn’t go amiss
OK, so the consensus is that the tags are useful, but could do with a spring clean. Anyone care to post some use cases and page/form code that would make them more useful out of the box? I can have a look and see if the propositions are viable.
The one about maintaining the existing URL in an article context is a good one, but I fear it’s going to take some doing. Techie reason #1 is that the URL is built up using pagelinkurl()
and there’s a block of code in there that is headed // can't use this to link to an article
:-( I have no idea why, but I’m not going to change that function since it’s used in loads of tags and also to generate feeds.
If anyone has any ideas/patches please feel free to submit them.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#14 2010-01-10 00:12:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Use of txp:image_index and txp:image_display tags
Bloke wrote:
Perhaps if you choose messy mode, the image_index links work inside an article? Don’t know.
Unfortunately it doesn’t, it still looses the id parameter in the url. Manually adding it makes it work again…
Offline
Re: Use of txp:image_index and txp:image_display tags
Els wrote:
Unfortunately it doesn’t, it still looses the id parameter in the url. Manually adding it makes it work again…
Thanks for the report.
OK, so a question for everyone then: can anybody think of a situation where you might want to use image_index/image_display inside an article and have the anchor’s URL return you to the ‘list’ view instead of showing the article again?
If not then I’d say this is unintended behaviour — perhaps even verging on a bug — in the implementation of these tags that should (somehow… no idea how yet) be addressed.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Use of txp:image_index and txp:image_display tags
Scenarios:
1. For a gallery-without-articles scenario, you can take my portfolio section. I needed to make a plugin or two out of these tags to make it go, expecially for the nesting categories (maybe with new txp capabilities this could be obtained with a bunch of conditionals and variable tag). But the concept is simple. How useful would be have image_index and image_display doing this out of the box? Now my plugins are a messy and not everything is working properly, but they added some attributes and possibilities that could be stolen in the tags rethinking.
2. Another scenario is sometimes (not now, unluckily) on my home page when I don’t have an image for the article. In those cases, I put an image display (without the index, in that case, so it’s not an effective scenario. But you ideally could also use an index) above the articles in home page. The images can be displayed in different ways: the last one from a category, a random one from a category or a category list; and it can be linked to another page (the portfolio section, as an example).
3. Inside an article, I’d like to have the possibility to have an index, maybe a default first displayed image, and then pass through the images in the index without changing the article. Think of a product page with many views. Or a tutorial. That would work without javascript (it would also lift page views up, ehm…). BUT you could also optionally add some rel=“lightbox” attributes here and there, so that, if js is on, the whole thing could work in javascript without url changing. Graceful degrading for those not having JS. Do not know if this is really really that simple (I suppose it’s not, because, the full images aren’t loaded by default), but someone cooler than me could think about it. :)
Hope this is useful!
Offline
Re: Use of txp:image_index and txp:image_display tags
Bloke wrote:
I have no idea why, but I’m not going to change that function since it’s used in loads of tags and also to generate feeds.
Way to get past the junktion with out updating URL functions, is to do something ugly like this (line ~2500 @ taghandlers.php):
global $s,$c,$p,$img_dir,$path_to_site,$thisarticle,$is_article_list,$permlink_mode;
Lost spacebar? From $url
to:
if($is_article_list == false)
$url =
permlinkurl($thisarticle).
(($permlink_mode == 'messy') ? '&' : '/?') .
'p=' . $id
;
else
$url = pagelinkurl(array('c'=>$c, 's'=>$s, 'p'=>$id));
Offline
Re: Use of txp:image_index and txp:image_display tags
Inside an article, I’d like to have the possibility to have an index, maybe a default first displayed image, and then pass through the images in the index without changing the article. Think of a product page with many views. Or a tutorial.
Those are uses I’m currently planning. Specifically, I’ll do a bunch of tutorials, each one being an article.
As I see it, the addition of forms for thumbnails iteration would be very powerful. And why not, a form for the displayed image as well?
But maybe that’s low priority, first one is to have the tags working as they should.
Offline
#19 2010-01-10 16:10:10
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Use of txp:image_index and txp:image_display tags
Bloke wrote:
can anybody think of a situation where you might want to use image_index/image_display inside an article and have the anchor’s URL return you to the ‘list’ view instead of showing the article again?
Only if I try very hard ;) IMO the tag wouldn’t need no further enhancement than just being context sensitive (i.e. don’t lose the individual article id in the URL, if there is one). For those who need more features there are all kinds of plugins. One might consider adding the attribute default
, like in Zanza’s plugin, but for me not even that would be necessary. I really like the simplicity of these native Txp tags…
(Edit: moved the thread to Feature Ideas.)
Last edited by els (2010-01-10 16:11:33)
Offline
#20 2010-06-02 11:56:02
- fantasmo
- Member
- Registered: 2010-05-05
- Posts: 40
Re: Use of txp:image_index and txp:image_display tags
Hi,
is it possible to have <txp:image_index> without the link <a>? link’=“0” is not allowed.
What I want to do… I just want to show some random pics sidebar from one of my image categories. But I don’t want them to be clickable (…if I change my mind one day, it would be ok, if the link leads to the article which contains the image… but right now it would be great if somebody knows how to get rid of the link of <txp:image_index>.
EDIT: I also appreciate any another tag-recommendation to build such a kind of image-teaser-showcase-thing in the sidebar. Maybe <txp:image_index> is not the right thing?!
Last edited by fantasmo (2010-06-02 11:59:32)
Offline
#21 2010-06-02 18:24:33
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Use of txp:image_index and txp:image_display tags
If your images are article images you could just use article(_custom) and the article_image tag, but I assume they are not. In that case the image_index tag doesn’t suit your needs, but there are plenty gallery plugins. For simple galleries I use upm_image in combination with wet_for_each_image a lot.
Offline