Hi all
how to make a WML view for rails pages?
I’ve tried to create like:
CONTENT
but my phone says unsupported content type…
thanks
Hi all
how to make a WML view for rails pages?
I’ve tried to create like:
CONTENT
but my phone says unsupported content type…
thanks
Do something like this in your controller
def configure_charsets
super
@response.headers[“Content-Type”] = “text/vnd.wap.wml;
charset=utf-8”
end
I have used the xml builder templates to make wap output. Start with two
lines like this.
xml.<<“<?xml version=\"1.0\" encoding=\"utf-8\"?>”
xml.declare! :DOCTYPE, :wml, :PUBLIC, “-//WAPFORUM//DTD WML 1.3//EN”,
“http://www.wapforum.org/DTD/wml13.dtd”
look here too
http://wiki.rubyonrails.com/rails/pages/
HowToProvideAlternateViewsForMobileDevices
Hi Biji,
I couldn’t try this, but this should help you anyways:
You have to serve the document with the correct content type header for
wml, which should be “text/vnd.wap.wml”, so in your controller you
should have a
@headers[“Content-Type”] = “text/vnd.wap.wml”
HTH,
Michael
Biji schrieb:
Hi!
I think the best thing is to use an after_filter like this:
class ApplicationController < ActionController::Base
after_filter :set_content_type
def set_content_type
@headers["Content-Type"] ||= "text/vnd.wap.wml"
end
end
Either you enable the filter in your ApplicationController (to enable
the wap header for the complete application) or only in specific
controllers. You can put the method set_content_type in your
ApplicationController and just enable the filter in each controller with
after_filter :set_content_type.
Using an after_filter and ||= allows you to set the header in some
actions manually. Only if that header is not set the filter sets the wap
header.
Bye,
TobStarr
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs