[drupal-devel] Dynamic Text Replacement

Solon solon at chiefcodemonkey.com
Wed Mar 23 06:42:01 UTC 2005

I plan on making themes with 'fancy' or non standard fonts. The only 
other practical way, opposed to CSS is to use PHP and GD, to replace 
the text with images.

I have found a method at 'A List Apart', (link 
here:http://www.alistapart.com/articles/dynatext/) which uses 
JavaScript to strip user selected tags and replace them with an image, 
created by GD in a user selected font, size and style. Any True Type or 
Open Type font can be used, leaving a very large choice for the end 

The PHP file can be located in the themes directory, but the question I 
want to ask is how would you implement the JavaScript. Would it be best 
to code it directly into the head of the theme template (using 
phpTemplate by the way), or create a module that get Drupal to print it 
to the head on page creation.

the second way would be best, as then Drupal handles everything, and 
you could turn it on and off, as well as have an interface to select 
for fonts and styles, but would it be okay to have a theme dependant on 
an external contributed module?

It would be possible for new themes to become 'Text replacement ready', 
and would include the fonts, and pre-made PHP file, so if the module 
was enabled, it would auto-find the files and handle the replacement 
for the user.

I would like to hear your ideas on the subject, whether you think it 
would be useful, or a waste of time.


More information about the drupal-devel mailing list