can i put same coding (wml and xhtml ) in one index.php file? i meant if any one log with a browser wich support xhtml he is redirected to xhtml part of that index.php file otherwise he is directed to wml part in dat same index.php file... could u plz post here an exaple file if possible? thanx in advance
Wml And Xhtml In Same Index.php
Started on the old forum in October 2007 · view the original in the archive · old links redirect here
can i put same coding (wml and xhtml ) in one index.php file? i meant if any one log with a browser wich support xhtml he is redirected to xhtml part of that index.php file otherwise he is directed to wml part in dat same index.php file... could u plz post here an exaple file if possible? thanx in advance
there are many different ways u can do this. try this.
wizard, that is a pretty useful script External image (may be gone) thanks! ...
hey dude thats the exact script for you to use, just read the script properly, you will understad.
<?PHP
include_once("includes/sources/device.inc.php");
class Body {
var $Body = '';
function header()
{
$Device = new Device;
if($Device->Device == 'wml')
{
header("Content-type: text/vnd.wap.wml; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
}
if($Device->Device == 'xhtml')
{
header("Content-type: application/xhtml+xml; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
}
if($Device->Device == 'html')
{
header("Content-type: text/html; charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
}
}
function start_page()
{
$Device = new Device;
if($Device->Device == 'wml')
{
$this->Body .= '<?xml version="1.0" encoding="UTF-8"?>';
$this->Body .= "\n";
$this->Body .= '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">';
$this->Body .= "\n";
}
if($Device->Device == 'xhtml')
{
$this->Body .= '<?xml version="1.0" encoding="UTF-8"?>';
$this->Body .= "\n";
$this->Body .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$this->Body .= "\n";
}
if($Device->Device == 'html')
{
$this->Body .= '<?xml version="1.0" encoding="UTF-8"?>';
$this->Body .= "\n";
$this->Body .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
$this->Body .= "\n";
}
}
function pghead($title)
{
$Device = new Device;
if($Device->Device == 'wml')
{
$this->Body .= '<wml>';
$this->Body .= "\n";
$this->Body .= '<card id="index" title="'.$title.'">';
$this->Body .= "\n";
}
if($Device->Device == 'xhtml')
{
$this->Body .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >';
$this->Body .= "\n";
$this->Body .= '<head>';
$this->Body .= "\n";
$this->Body .= '<title>'.$title.'</title>';
$this->Body .= "\n";
$this->Body .= '</head>';
$this->Body .= "\n";
$this->Body .= '<body>';
$this->Body .= "\n";
}
if($Device->Device == 'html')
{
$this->Body .= '<html>';
$this->Body .= "\n";
$this->Body .= '<head>';
$this->Body .= "\n";
$this->Body .= '<title>'.$title.'</title>';
$this->Body .= "\n";
$this->Body .= '</head>';
$this->Body .= "\n";
$this->Body .= '<body>';
$this->Body .= "\n";
}
}
function pgfoot()
{
$Device = new Device;
if($Device->Device == 'wml')
{
$this->Body .= '</card></wml>';
}
if($Device->Device == 'xhtml')
{
$this->Body .= '</body></html>';
}
if($Device->Device == 'html')
{
$this->Body .= '</body></html>';
}
}
function show_Body()
{
echo $this->Body;
}
}
?>
this is the body.inc.php. u can use this thing and get this working with your any type of script.
that is php 4 but php 4 will be discontinued as of the 31st of december so i recoded in php 5 but i wont give dat 1 out. however i can show how it is done
awesome wizard External image (may be gone) i think we can also use the codes of personal wap sites in lava script. it has both xhtml and wml in same page. and simple to use.