Hi all how to make a WML view for rails pages? I''ve tried to create like: <wml> <card> CONTENT </card> </wml> but my phone says unsupported content type... thanks -- Posted via http://www.ruby-forum.com/.
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
On Friday, March 10, 2006, at 2:00 PM, Biji wrote:>Hi all
>
>how to make a WML view for rails pages?
>I''ve tried to create like:
><wml>
><card>
>CONTENT
></card>
></wml>
>
>but my phone says unsupported content type...
>
>
>thanks
>
>--
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
--
Posted with http://DevLists.com. Sign up and save your time!
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 all > > how to make a WML view for rails pages? > I''ve tried to create like: > <wml> > <card> > CONTENT > </card> > </wml> > > but my phone says unsupported content type...
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
--
Posted via http://www.ruby-forum.com/.