Thanks Ross, I'll give the new preg_replace a go.
I've already explained to the client that there is no need for a text only site, as the design is xhtml/css and already accessible. She only has limited knowledge of the subject and is being fairly insistent, so I'm implementing it anyway.
Cheers Mark
On 7 Nov 2006, at 17:20, Ross Kendall wrote:
Hi Mark,
You could try this:
<?php $pattern = '/<img[^>]*?((alt="(.*?)".*?>)|>)/i';
$replacement = '(Image: $3)'; print preg_replace($pattern, $replacement, $content); ?>
However, I do not think this whole approach is needed. Web users who don't want to view images can disable them in their web browser - the job of the web designer is to make sure that the website works well either way. When I'm working on a design I always test with CSS and images disabled.
Cheers, Ross.
Mark Hope wrote:
Hi,
I'm creating a text only version of a site and would like to replace inline images with their alt text.
In my template files I have:
<?php print preg_replace("/<img[^>]+\>/i", "(image) ", $content) ?>
which replaces all images with: (image)
what code would I need to create output like: (Image description: THE ALT TEXT HERE)
and is this best practice?
Regards Mark
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes