Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  Dynamic CSS and Javascript - can it get any better dude?

seancharles
Posted: Sat Jan 05, 2008 7:06 pm Reply with quote
User Joined: 18 Jul 2007 Posts: 57
On a whim, I tried this in my page output code:
Code:
{script, [{src,?JSCRIPT++"test.js.yaws"},{type,"text/javascript"}]},

and then I created this test file"
Code:
/**
 ** Proof of concept: Yaws/Erlang generated Javascript!
 **
 ** Each time this page is called it generates a different time
 ** thus proving that I can generate 'dynamic' javascript.
 **/
function woohoo() {
    alert('Test yaws js, the time is<erl>
out(A)->
    {html, io_lib:format("~w",[now()])}.
</erl>');
}

IT WORKED! I guess that I knew it would but the possibilities are endless now. What an awesome capability in the wrong hands! Very Happy

-- I could generate *user* specific javascript on the fly based on session content.

-- I can create custom functions that apply to the current page context very easily.

-- and a million more uses I have yet to think of!

I am now in the process of re-factoring my CSS for my site to have a set of bindings at the top eg major theme colour and then I can use them to generate a 'CSS' file that is utterly tweakable. I hate having to change twenty places in a CSS file just because a colour has changed, now I need only define it as a variable and use it where I need it. Cool!

I *know* I can use SSI and bindings but damn it all this just feels more fun like changing the tyre on your car without stopping first!

Smile
Double wooo-hoooooooo!
->Sean Charles
View user's profile Send private message
tiffanly
Posted: Thu Aug 06, 2009 6:38 am Reply with quote
Joined: 04 Aug 2009 Posts: 1
How can I install javascript so i can chat using itzamatch? Itzamatch uses javascript for chat, my computer is not responding probably its not installed yet. How can Install javascript?
_______________
affiliateelite ~ affiliateelite.com ~ adgooroo ~ adgooroo.com
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum