[drupal-devel] Dynamic Text Replacement

Vladimir Zlatanov vlado at dikini.net
Wed Mar 23 09:22:07 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 would use CSS + PHP + GD, basically the idea is to include in your header (in the theme)
a link to a generated css file, containing only the style definitions
for the image replacement. For example the relevant H1s. It can be done
as inline styling in the theme as well. 

To be able to assign fonts, etc... you will need to modify one of the
theme engines, AFAIK. or write a module, but then UI interface and paths
consistency start grinning at you.

I'm eyeing this idea for some time, but just don't have enough time to
play with it.

> 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 
> user.

> 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.
Both are valid methods, if you want configurability, then module is probably
the better way, as the template path will most probably require engine
modification (adding extra config options, might be wrong, not an
expert), and different template engines handle things differently.

A hook for extending the template form? Have no clue, but sound like 
a good idea to me.
Any opinion, or a ready resolution?




More information about the drupal-devel mailing list