Nokia's Code Camp in Barcelona
Home / Utilities


Utilities Home

Alembik
 uaprofile2wurfl.php Gimme UAProf and I'll give you WURFL


Alembik
 Alembik Media Transcoding Server is a Java application providing transcoding services for a variety of clients.


GAIA Reply
 GAIA Image Trascoder
Open Source library that operates image transcoding, with a special focus on mobile applications.

WURFLTera
 Tera-WURFL
Use MySQL as a WURFL-powered backend!!!

WURFL Utilities
 mDevInf
GUI to query *your* WURFL, by James McLachlan

Device Thumbnails
 Device Thumbnails
Add device thumbnails to your appliction!

PHP Image Rendering Library (II)
 Dynamically resizing pictures in PHP (a new one)


PHP Image Rendering Library
 Dynamically resizing pictures in PHP


BeeWeeb's MWT
 Mobile Web Toolkit
Open Source library that talks to the same publishing system as your website, but generates a mobile site.

Wallify
 Wallify
Turn a CHTML site into a WALL site.

Image Server
 Image Server
A Java Servlet (and filter) that will intercept requests to picture and resize the picture appropriately by looking at the screen size. Very Cool!





SourceForge.net Logo
 

Wallify
by Marten van Wezel
Download

README.txt

Wallify-2.0
(c) 2006 Marten van Wezel
Flying Weasel Mobile

"Hey - it helps." 
    - me.

This set of scripts was whipped up quickly and bluntly by 
yours truely. I do not claim it to be elegant, or (<legalese>fit for 
any purpose whatsoever, usage is entirely at your own risk</legalese>).
Plus hey it's free. I think (no promises) it's also pretty safe,
it either moves your old file to a safe place, or it only creates
a walled, renamed version. Try it, if it doesn't work, leave it.

The program has basically served it's purpose for me, my site is now 
fully WALL'ed, so I don't know if I will be doing much maintenance. 
If you spot bad bugs, feel free to mail me at wallify-theatsign-puntloos.nl

PURPOSE:
- To HELP convert (C)HTML, PHP, maybe JSP and uh.. dont bet on it C(+)(+) 
  code to "Wall enabled code". 
- Specifically: do NOT expect this system to output files that are ready to go. 
  It might, if you code just like me, and if the code is linear. 
  It won't be 100% otherwise. It will just save you a LOT of time compared
  to doing it entirely by hand.
- The scripts just try to replace, append or prepend tags with wall tags,
  so in most code, it should work without damaging program code. 

PREREQUISITES:
The following programs need to be installed for (full) functionality:
- bash
- sed
- grep
- php (if you set the system to postparse (block-ify))

HOW IT WORKS:
It basically just looks through a file, sniffing out any non-wall 
HTML-like tags. It should work on html,  chtml and xhtml, but NOT on WML. 
A lot of semi-intelligence is put in there to make it smarter:

- It will lowercase all tags it knows.
- It will make most output code fairly readable.
- It will produce code that's intended to even be WML-compatible.
- It will encase all code in <wall:block>'s.
- It will even know what to do with some forms.
- It will end a <wall:block> when a <form> starts
- It will start a <wall:block> when a <form> ends.
- It will put out some diagnostic messages helping you to sniff out trouble.
- It replaces <p> with </wall:block><wall:block>
- It will NOT add the initial wall tags like 
  "<wall:document><wall:xmlpidtd/><wall:head>".
  For this I suggest you take a look inside the template dir.
  (see below)
- It WILL mangle code that somehow "looks for html tags". Like itself. 
  For example: "if ($inputline="<br>") {" will be
  transmogrified to  "if ($inputline="<wall:br/>) { 
  wether that's the point or not. With 'normal' code, you're safe.
- It will replace numbered and unnumbered lists by things 
  like -  element1

USAGE TIPS:
- The default settings are reasonably sensible. 
- I suggest linking both the 'wallify' and 'wallcheck' binaries 
  into your (unix) system path. Remember to set the path inside postparse.php, 
  wallify and wallcheck
- Then just run "wallify code.php" on any php or jsp or .html file. It will output 
  <filename>.wall
- Rechecking the result code for potential errors is done with
  "wallcheck code.php.wall"
- Use the template sample.
- Check the configuration directives in wallify, wallcheck and postparse.php
- Use my form replacement function for text fields / textareas (See below)

CORRECTING WALLIFY'S MISTAKES
Wallify will most of the time take the conversion process to "95% done". 
Here are some of the things that will need checking.
- It will open the first <wall:block> right before the first <wall:..> tag 
  it finds. However, if you start your page with text before any tags, you 
  should move the first <wall:block> to before that spot. The same applies 
  to the very last </wall:block>. You should move it to behind the last 
  place your code will output anything.
- It can't comprehend loops, so code like:
	echo "<form action="oink.php" method="post">";
	if ($gna == "huhu") {
		echo "<input type="radio"... </form>";
	} else {
		echo "<input type="text"... </form>";
	}
  will most certainly confuse its "when should I open and close blocks" 
  code (the 'postparser').
- It will also have trouble, or fail to recognise code that very dynamically 
  generates HTML. It will fail with stuff like:

$CONTENT .= "<option value=\"7\" ";
if($vote == 7)  {
	$CONTENT .= "selected";
}
$CONTENT .= ">Whee!</option>";
- In fact the <option>... tags are really 'too dynamic' so those will 
  probably partially fail. 

ABOUT TEMPLATES
Wall4php has a nasty habit of returning a 100% blank page if you mess up 
your wall code and/or still have some non-wall tags in there. For this 
reason I've created a template with a 'debugmode'. Just add "&debug=yes" 
to your URL. (http://mysite/mypage.php?gna=huhu&debug=yes). 
With this, you can see the wall code the wall4php parser choked on.

- Check out template.php, inside the "template" subdir. You don't have 
  to use it, but the testmode is worth it, IMHO.

- Your code format should be like template/example.php
	i.e. write all actual html not to screen (with 'echo' or 'print')  
  but to a $CONTENT variable. Then, when you include template.php, it will 
  add wall headers and footers, and a proper 'look and feel' to your site. 
  It also calls wall4php.
	
- If you use my template, you will have a 'debugmode'. This mode will 
  (very nearly) output a non-rendered version of the output page, which is 
  especially useful when viewed in a text editor ('view source') 

- Copy template.php into your site, and move the fake*.php files right 
  next to the wall4php files. Also edit the "prefix" in template.php to 
  point to those files.

ABOUT TEXT FIELDS IN FORMS
WML phones do not allow the <textarea></textarea> tag.
They only have <input type="text"...> For this reason I suggest
 you include the rendertextform.php in your code. Check it out.

- If you encounter either the "text" input field (<input type="text"...> 
  or a <textarea> in your code, replace it with:
  renderTextForm($sMarkup,$nMaxSize,$nRows,$nColumns,$sName,$sDefaultValue),
  where:
	$sMarkup - the preferred_markup wurfl code for your phone.
	$nMaxSize - the maximum amount of chars allowed. 
                    This doesn't work for textarea blocks.
	$nRows, $nColums - width and height of the text area, if possible
	$sName - the input or textarea name
	$sDefaultValue - what should be in the form as a default.

That's about it. Happy WALL'ing.

QUICKSTART
1/ Unpack the archive to /usr/local
	- It will make a dir 'Wallify-2.0'
2/ cp template/template.php /path/to/your/siteroot/template.php
2b/cp template/example.php /path/to/your/siteroot/example.php
3/ cp fakewall/* /path/to/Wall4PHP
4/ edit template.php ($prefix) to point to /path/to/Wall4PHP/
5/ Try http://mysite.com/example.php with your browser
6/ Try http://mysite.com/example.php?debug=yes with your browser 
   (use 'view source'!)
7/ run:
	wallify sourcefile.php
   or
   	wallify sourcefile.jsp
8/ check out sourcefile.php.wall, fix mistakes 
   (wallify should output some hints)
	- The very first and very last block are probably not
          in exactly the right place. Move them up and down, respectively.
	- Wall4PHP will also choke on random < and >'s -
          you need > and < of course.
	- Dynamically generated HTML might break, especially
          in conditional statements.
9/ move sourcefile to originalname (sourcefile.php)
10/point your browser to it
11/If you're using the template, try &debug=yes for error hunting.
Download



Enjoy!

Copyright © 2008, Luca Passani