Share » Forums » Setup & design » using texttoimage in stylesheet

using texttoimage in stylesheet

using texttoimage in stylesheet

Saturday 19 November 2005 12:59:46 pm - 4 replies

Author Message

Roy Bøhmer

Saturday 19 November 2005 2:46:20 pm

I'm on really thin ice here, but I think it should be possible. But you have to write the css-statement directly in the template - not in an external .css-file.

The styles have to be surrounded by {literal}{/literal} so the curly brackets wont be interpreted by ez-template engine.

<style>
{literal}
h3 { 
{/literal}
{"Your text"|texttoimage('h3')}
{literal}
}
{/literal}
</style>

I've not tried the above code. Hope you'll work it out!

Roy

Alberto Perni

Saturday 19 November 2005 3:04:11 pm

Thanks for you reply Roy! :)

Alas, AFAIK, that would create an <img> tag within the css statement.

I guess I'm looking for something that could generate the texttoimage image, and return me a string containing the url to it, instead of dynamically writing the html code.

Any help on this?

Roy Bøhmer

Saturday 19 November 2005 3:50:03 pm

Oops... was a little to quick there, I guess.

A little resarch found: design/standard/templates/image/layer.tpl is used as template for the texttoimage. (You should copy the file to your own design...)

But if your using this for other purposes than css I'll guess you have to do some serious overrides or perhaps some if-statements in the template. I've no ides which other functions in ez that relies on the above mentioned template.

Roy

Alberto Perni

Saturday 19 November 2005 6:09:29 pm

Thanks for the tip Roy!

I have succesfully managed to adapt layer.tpl to make it return only the full url to the image generated by texttoimage:

content of layer.tpl:
{$layer.imagepath|ezroot("single")}

The "single" parameter adds single quotes to the url. Handy for applying this to the css statement.

However, as you've mentioned, it has its drawbacks. I've seen that Imagefile() also makes use of this template.

Sorry if this sounds crazy, but is there any way to create an override just for the texttoimage function?

The perfect solution would be a method, function or a parameter to either image() or texttoimage() telling I only want the url of the image. So far I haven't found anything :(

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu