Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-10 16:57:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Give us back our caption!

I was recently faced with a 4.0.4 problem in the hblack.net site. I am using a modified version of bas_lightbox plugin and on upgrading to 404 the whole of the site was in disarray due to a small change-pointed to me by rloaderro – in the taghandlers. That change was on line 245 which reads: ($caption ? ' title="'.$caption.'"' : ''). . The problem with this is that it limits the image caption to text. My suggested code is
($caption ? ' title="'.$alt.'"' : ''). . This will free the caption for users to use it as they see fit which is not always how the developers intended the field for. The ideal situation would be to have an extra ‘title’ text field and have the caption as a field like the link description one.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2006-11-11 17:14:06

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Give us back our caption!

Does no one have an opinion to this?

I’d like to present my case in another way.
Txp’s image tab, although there is room for improvement, most of that improvement can and does come from plugins. There are a lot of them out there to suit most needs as far as image handling and presentation goes.

That was of course the case up to txp v.4.0.3. With txp v4.0.4 the edit image tab is more ‘limited’ by what comes out of the box. The caption field included is a multi line text field not just a single line which is the case of all other fields in the tab. Multi line means freedom to the user to include whatever else in that field and call it in the front end (either with the use of plugins, which is the case for most of us or with some php wizardry). Even the naming convention used for the field was caption : the explanatory comment or designation accompanying a pictorial illustration. It is a text which accompanies the illustration not hidden within it.

By reducing that field into a “title attribute” our freedom is gone.

c’mon guys all i’m asking is to claim back the freedom of the ‘caption’ field…

That’s it… if there is a case against my feature request I’m all ears:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2006-11-11 18:30:24

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Give us back our caption!

Other solution: when using $caption as ‘title’ attribute value, apply strip_tags and htmlspecialchars (or escape_title). This removes the limitations on the contents of $caption, so you would be free to include whatever you want in that field.
Title and Alt attributes are not identical and should not be forced to have the same values.

Last edited by ruud (2006-11-11 19:53:02)

Offline

#4 2006-11-11 19:12:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Give us back our caption!

Or another solution would be to use the “image name” for a title attribute. Anything but the caption. But the request here is not how I would hack the code so as to have the site working as I intend it to. The request here is for a recognition of what the caption field can do. And that is far more than becoming a title attribute.

Last edited by colak (2006-11-11 19:17:32)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2006-11-13 23:36:28

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Give us back our caption!

This will free the caption for users to use it as they see fit which is not always how the developers intended the field for.

The request here is for a recognition of what the caption field can do.

  1. That’s what plugins are for.
  2. There is no “hacking” required.
  3. If you did happen to put XHTML in that field, you can use the escape attribute to “clean” it.
  4. Of course the caption field can do lots of things. That’s why built-in tags have one approach, and if you don’t like it, thus enters the plugin.

One of the top complaints with images has always been, “Why is there a place to enter a caption if it doesn’t get used?”. Now it does.

Offline

#6 2006-11-14 08:04:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Give us back our caption!

Mary wrote:

This will free the caption for users to use it as they see fit which is not always how the developers intended the field for.

  1. Of course the caption field can do lots of things. That’s why built-in tags have one approach, and if you don’t like it, thus enters the plugin.

One of the top complaints with images has always been, “Why is there a place to enter a caption if it doesn’t get used?”. Now it does.

Well it does but I feel in a very limited way. What about if there is a tag for the caption?

ie something like <txp:image_caption /> which could be called from a form in a similar way links do <txp:image /><br /><txp:image_caption />


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2006-11-14 08:23:54

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Give us back our caption!

Mary wrote:

If you did happen to put XHTML in that field, you can use the escape attribute to “clean” it.

As a user I’d expect the escaping for the title attribute to happen automatically. TXP shouldn’t generate invalid attribute values. I think it’s possible to escape automatically, if needed (IIRC, I sent in a patch some time ago that tried to do so, using escape_title, which isn’t perfect but better than not escaping at all by default)

Offline

#8 2006-11-14 13:47:43

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Give us back our caption!

  • Would that not mean repeating info? e.g: <txp:image id="5" /><br /><txp:image_caption id="5" />, every time you added an image?
  • We’ve already gone over this, but escaping is a new concept to Textpattern, hence optional. 4.0.4 already had more than enough revisions to trouble itself with.

Offline

#9 2006-11-14 18:07:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Give us back our caption!

Mary wrote:

  • Would that not mean repeating info? e.g: <txp:image id="5" /><br /><txp:image_caption id="5" />, every time you added an image?

Very true!!! What about about <txp:image id="5" caption=TRUE />? The problem with this is how will the caption appear… After a <br /> under the image, next to it… I know I’m asking for things I am yet to clarify 100% myself… caption is definetely Not title though…

Maybe the caption should be contained in a span class so if the above is called, then we can get something like <img src="/images/5.jpg" alt="image" border="0" height="260" width="400"><span class="txpcaption">caption is here</span>

Last edited by colak (2006-11-14 18:08:55)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#10 2006-11-16 07:17:32

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Give us back our caption!

And the whole inside a div, yup that’s probably the way to go Colak.

Offline

#11 2006-11-16 09:30:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Give us back our caption!

Jeremie wrote:

And the whole inside a div, yup that’s probably the way to go Colak.

yep without the border attribute so as to give individuals the choice for that… I am not certain re the wrapping div as it does not allow for user choice. My personal choice would be dl/dt. I know I might go into deep non txp waters here but what if it is
<txp:image id="5" caption="dt" /> where the caption variable is called as true and its ="" denotes its wrap tag. This method would be very flexible in the presentations… me thinks…

Last edited by colak (2006-11-16 09:39:57)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2006-11-16 10:12:52

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Give us back our caption!

Can’t this be handled similar to how links are dealt with… link_list with a form that defines how you want the link displayed; in this case image_list with a form that defines how to format the image + caption? (hmm… although that doesn’t deal with individual images).

Last edited by ruud (2006-11-16 10:14:22)

Offline

Board footer

Powered by FluxBB