Did you know, Part III (How to 'roll' your own prayer wheel)
Posted on Aug 25th, 2006
by
Mila
I've had several requests about Zaadz' 'digital prayer wheel' and how to implement it on others' web sites. There are a lot of ways to do it -- you could simply add it in the HTML of each page of your site if you have access to that, for example.
The way we do it at Zaadz is by adding an HTTP header. In Rails, that's done like so:
class ApplicationController < ActionController::Base
before_filter :powered_by
.. mysterious and wonderful Zaadz code snipped for brevity ...
def powered_by
@headers["X-Powered-By"] = "Zaadz"
@headers["X-Mantra"] = "Om Mani Padme Hum"
end
end
This tells the server to send X-Mantra: Om Mani Padme Hum to your browser as part of the response when you load our page. You never actually see this, since request and response headers are part of the way our server and your browser 'talk'.
The X in X-mantra serves only to tell both server and browser that this is an extra header that it both can safely ignore.
In PHP, you can do the same with the header() command, and most other web languages have some method for doing the same thing.
Anyway, last geeky/techy post from me for a little bit. I want to return to other topics that've been on my mind lately.
Tagged with: ror, rubyonrails, prayer wheel, dharma, ruby on rails, rails, ruby, php, headers, x-mantra, compassion

Help




Thank you Jake,
You are a friend and a wonder. It will be great to participate in just one more way. I am in your dept.
iam
Always enjoying your geeky/techy posting!
thanks Jake! you inspire me! :)