I would like to dynamically load an alternative image held in a CCK ImageField. I haven't checked the 6.x-3.x beta, as this is a production site running the recommended 6.x-2.5 release, but I suspect this applies to both branches.

I see two ways of achieving this - either allow tokens (including CCK field values) in the "HTML alternative" box or provide a secondary "PHP alternative" box with its own permission allowing people to do more advanced stuff if they can.

I will work on a patch now. I'll try tokens first, as it seems the more sensible approach if I can do what I need with them.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greg.harvey’s picture

Status: Active » Needs review
FileSize
1.8 KB

Patch as promised - allows you to use node tokens in the HTML alternatives box.

spgd01’s picture

The purpose of swfobject2 "HTML alternative" is to provide custom information if flash cannot play and to provide HTML to search engines and those who do not have flash. this way you can display text or images to be indexed or read rather then a blank screen.

Do you think this patch can be used or modified so that we can have custom "HTML alternatives" for each node?

greg.harvey’s picture

Yes, it is. You've lost me. Why are you explaining that? The feature request (and patch) allows you to include tokens in the 'custom information if flash cannot play', which is kind of handy - not only for my use case but for others too. Are you saying you don't get why this patch is needed? Maybe I'm searching for a motive that isn't there, but I find your post a bit weird, given the context...

As for your additional comment, that would be significantly more complex. Probably best for a separate feature request. The purpose of this patch is simply to allow tokens - any tokens - to be used in the context of the "HTML alternative" box. To do this no additional structure or thought is required. That's why the patch is so small. This is so trivial that, unless someone objects to the inclusion, it should be a quick add.

greg.harvey’s picture

Title: Allow the "HTML alternative" text to be more advanced » Allow tokens in the "HTML alternative" textarea so content can be dynamic

Actually, I should re-title this issue to reflect the patch, as it met my purposes nicely. Perhaps the title is the source of confusion.

spgd01’s picture

greg,

Sorry If i confused you. I understand what your patch does. Thanks. New title is better.

However, I want to replace the entire html not just a token. What I was trying to explain was that in swfobject "alternative html" isn't just for displaying "opps you don't have flash" it was for SEO content etc. I just thought that would help explain my request. Because as the " html alternative," as it is currently set up, is universal for every page that uses swftools.

What I was asking for was for a way to make the entire "html Alternative" text be changed for each node. So when creating a node we could have a CCK field (like the body filed) to input the alternative HTML?

I ask this because in case I have a flash image slide show or a movie I would like to to have alternative html for the images and written copy in case flash brakes and for SEO.

Do you know of a way to do this?

I hope that makes sense.

greg.harvey’s picture

Oh, I see... yes, token support (this patch) will allow that. Here's what you do:

1. Create a CCK textarea field on the content type called something like "SWF alternative text"
2. Put your replacement text in that field (which can obviously be different for every node)
3. In SWF Tools admin set the 'HTML alternative' box to contain just the token for that field, e.g. [field-my_field_name]

That's it! All your CCK fields are available as tokens so you can use one in it's entirety. =)

greg.harvey’s picture

Status: Needs review » Reviewed & tested by the community

Marking as R&TBC - no one else seems to be testing this, but it does work - it's being used here:
http://www.economistconferences.co.uk/

roball’s picture

I think you should also verify that the patch is working in the 6.x-3.x branch since this is the one new features will get in. Very useful indeed!