Page 1 of 1

Serving wap pages

Posted: Thu Sep 06, 2007 9:59 pm
by wapcamer
Hi all,
Completing my website, I have a wap site.
The thing is that wap pages must send particular MIME-types.
In my current site, I use the following line in the .htaccess
AddType text/vnd.wap.wml wml

Now I would like to do the same with the CSMSMS. The template and the DTD is no problem, it is really the server that should send back text/vnd.wap.wml instead of text/html or smthg.

Do you know how to achieve that?

Other question, I would like to use the menu manager to handle the menus. Unfortunatly I have disabled the menu presence for the wap pages so that they don't show up in the menus of the regular website. Is there a way to still use menumanger or should I only make static links? There aren't really a lot of pages so it's not really a big deal if it can't, I just want to know.

Thanks a lot.

Re: Serving wap pages

Posted: Fri Sep 07, 2007 3:01 pm
by Pierre M.
Hello,

do you want the same content (same site, same hierarchy of same pages) to be broadcasted to both traditionnal browsers and wap browsers ?

IIRC wap/wml groups pages by "set of screens" where HTML maps one page/request to one screen/rendering. Am i correct ? If yes, are you making "sets of 1" to replicate the same mapping ?

Then, do you have enabled pretty URLs ? Do you use a .html suffix ? an empty suffix ?

What do wap browsers accept/send in HTTP requests ? I mean :
Accept: text/vnd.wap.wml; q=1.0, text/html; q=0.2, text/*; q=0.1 ?
Can you rewrite queries according to this HTTP header ?

I need some wap uptodate info to go on this topic ;)

On the menu hiding topic : if your wap browser understands HTML/CSS, try display: none in the divCSS with media=somewap

Pierre M.

Re: Serving wap pages

Posted: Fri Sep 07, 2007 6:52 pm
by wapcamer
Hi Pierre, thanks for replying.

First no, the content is different. i want to keep it simple ( ;)) so there is a web site and there is a wap site.
The idea is to have one instance of cmsms handling both of them.

I know CMSMS is not mulitsite yet, so it's okay if I can't use the menu manager since I only have three pages on the wap, I can build the menu myself the old-style way.

Wap browsers are supposed to accept text/vnd.wap.wml
On my own device I know I can run the regular site wihtout any problem but I would like to keep the wap part of the site close to the wap specs (or to what I currently have)

I haven't used the media type feature of the stylesheets pages because I don't know what it really does. Is there a real interpretation of the querying device ? Can CMSM really make the difference between aural, braille, embossed, handheld, print, projection,.... I have doubts about it since I don't think it has a list with all imaginable User-Agents.
Anyway I made a try to associate my wap template with the handheld css with no luck. I mean the page displays correctly - which shouldn't because firefox or IE are not supposed to read wml natively (FF can do it though with the help of a plugin).

Regarding th pretty urls, I'm not sure, but I think yes since the title is in the URL; I hope I'm right because it is important for referencement. The typical url is "http://blablabla.com/cmsms/index.php?page=wap

To summarize, my issue is really sending "text/vnd.wap.wml" as content type in the HTTP reply header.

Thanks

Re: Serving wap pages

Posted: Fri Sep 07, 2007 8:45 pm
by alby
wapcamer wrote: I haven't used the media type feature of the stylesheets pages because I don't know what it really does. Is there a real interpretation of the querying device ? Can CMSM really make the difference between aural, braille, embossed, handheld, print, projection,.... I have doubts about it since I don't think it has a list with all imaginable User-Agents.
No, you can send all media styles but it's browser device that interpreter the correct media style (if present)

wapcamer wrote: Anyway I made a try to associate my wap template with the handheld css with no luck. I mean the page displays correctly - which shouldn't because firefox or IE are not supposed to read wml natively (FF can do it though with the help of a plugin).

To summarize, my issue is really sending "text/vnd.wap.wml" as content type in the HTTP reply header.
See this topic and this information

Alby

Re: Serving wap pages

Posted: Fri Sep 07, 2007 9:51 pm
by wapcamer
Hi Alby,
thanks for your reply.
I had come through that topic already but it doens't suit my need.

I don't want to adapt the rendering of my content according to the browser kind, it's much simpler: I just want to serve my wap pages with wml content-type in the header.

By the way, I've tried writing an UDT containing:

Code: Select all

header("Content-Type: text/vnd.wap.wml");
and the UDT at the very beginning of my wap template, but still no luck.
I guess the header must have been sent already since the content-type stays "text/html".

Re: Serving wap pages

Posted: Fri Sep 07, 2007 10:07 pm
by calguy1000
Try this:

Create  A UDT with this code in iit:

Code: Select all

global $gCms;
$gCms->variables['content-type'] = 'text/vnd.wap.wml';
and call this UDT from the very top of your template.

in index.php the content type is sent out just before the html is.... and after the smarty is processed, so this should work.

Re: Serving wap pages

Posted: Fri Sep 07, 2007 11:45 pm
by wapcamer
Thank you Calguy,
you roxxx, that did (almost) it !!!

The content-type sent in the HTTP reply is :
Content-Type: text/vnd.wap.wml; charset=UTF-8

That's why I wanted...

However, it seems the "; charset=UTF-8" string is messing up with IE and even FF.
Do you know a way not to add that at the end of the Content-Type line ?

Re: Serving wap pages

Posted: Sat Sep 08, 2007 12:10 am
by calguy1000
You could just hardcode the line in index.php (there's only one header call, it's easy to find).

Re: Serving wap pages

Posted: Sat Sep 08, 2007 6:54 pm
by wapcamer
Pocket Explorer doesn't like either the charset string in the cotent-type.

I might follow your advice and delete the line in index.php (even though I'd rather avoid it for maintenance purpose) if you can garantee me there is no incidence on the web pages for regular browsers.

Anyway thank you very much for the help.

Re: Serving wap pages

Posted: Sat Sep 08, 2007 7:16 pm
by calguy1000
Quite honestly I think that that line in index.php should be a bit smartyer.
if the template encoding isn't set, it shouldn't output any charset stuff.... I'll think about adding that to the 1.2 list.

Re: Serving wap pages

Posted: Sat Sep 08, 2007 10:44 pm
by wapcamer
index.php line:288

Code: Select all

header("Content-Type: " . $gCms->variables['content-type'] . "; charset=" . (isset($pageinfo->template_encoding) && $pageinfo->template_encoding != ''?$pageinfo->template_encoding:get_encoding()));
The one line test keeps code shorter, but indeed it may be a little bit more precise.
I would do something like:

Code: Select all

$encoding='';
if (isset($pageinfo->template_encoding) && $pageinfo->template_encoding != '')
     $encoding="; charset=" . $pageinfo->template_encoding;
header("Content-Type: " . $gCms->variables['content-type'] . $encoding);
and drop the default 'get_encoding()'

but I'm not a php expert.

Still, I have looked everywhere, I haven't been able to find where to define one template's encoding.
Is it possible to define the encodeing separately per template?

Will there be a 1.2 release before the so long awaited 2.0 ?

Re: Serving wap pages

Posted: Sat Sep 08, 2007 10:59 pm
by calguy1000
There 'Used to be' a place where you could define an encoding per template.... it's not around anymore

and yes, there will be a 1.2 release, but it'll be THE LAST feature feature release in the 1.x series
and the 2.0 series will probably break backward compatibility.

Re: Serving wap pages

Posted: Sun Sep 09, 2007 12:05 am
by wapcamer
There 'Used to be'
Such a shame, it breaks the great modularity of CMSMS, which made me choose this CMS.
Maybe you know a way to hack direclty the db to modify the charset by hand (actually simply deleting it should be enough with the test  !='' )

Otherwise, I might consider keeping my static wap site, which is not a very big issue.
the 2.0 series will probably break backward compatibility
Good to know. In this case, I will not wait for the 2.0 release for my website. I wanted it for multilingual stuff but since I could come up with a solution I'm happy with, it's not worth waiting then.