Wml And Xhtml In Same Index.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Wml And Xhtml In Same Index.php

    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

    #2
    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[/b]

    there are many different ways u can do this. try this.
    Attached Files

    Comment


      #3
      there are many different ways u can do this. try this.[/b]
      thanx wizard but this is not wat i meant, i meant in one index.php, can make xhtml codes and wml codes?
      ex
      if($site=="wap"){


      and

      if($site=="html"){

      Comment


        #4
        wizard, that is a pretty useful script thanks!
        ...
        -----------------------------------------------------

        hey dude thats the exact script for you to use, just read the script properly, you will understad.
        Code:
        <?PHP
        include_once("includes/sources/device.inc.php");
        
        class Body {
        
            var $Body = &#39;&#39;;
        
                function header()
                {
                $Device = new Device;
        
                    if($Device->Device == &#39;wml&#39;)
                    {
                            header("Content-type: text/vnd.wap.wml; charset=utf-8");
                            header("Cache-Control: no-store, no-cache, must-revalidate");
                    }
                    if($Device->Device == &#39;xhtml&#39;)
                    {
                            header("Content-type: application/xhtml+xml; charset=utf-8");
                            header("Cache-Control: no-store, no-cache, must-revalidate");
                    }
                    if($Device->Device == &#39;html&#39;)
                    {
                    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 == &#39;wml&#39;)
                        {
                            $this->Body .= &#39;<?xml version="1.0" encoding="UTF-8"?>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">&#39;;
                                $this->Body .= "\n";
                        }
                        if($Device->Device == &#39;xhtml&#39;)
                        {
                            $this->Body .= &#39;<?xml version="1.0" encoding="UTF-8"?>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">&#39;;
                                $this->Body .= "\n";
                        }
                        if($Device->Device == &#39;html&#39;)
                        {
                            $this->Body .= &#39;<?xml version="1.0" encoding="UTF-8"?>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">&#39;;
                                $this->Body .= "\n";
                        }
                }
        
                function pghead($title)
                {
                $Device = new Device;
        
                        if($Device->Device == &#39;wml&#39;)
                        {
                                $this->Body .= &#39;<wml>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<card id="index" title="&#39;.$title.&#39;">&#39;;
                                $this->Body .= "\n";
                        }
                        if($Device->Device == &#39;xhtml&#39;)
                        {
                            $this->Body .= &#39;<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<head>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<title>&#39;.$title.&#39;</title>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;</head>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<body>&#39;;
                                $this->Body .= "\n";
                        }
                        if($Device->Device == &#39;html&#39;)
                        {
                            $this->Body .= &#39;<html>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<head>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<title>&#39;.$title.&#39;</title>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;</head>&#39;;
                                $this->Body .= "\n";
                    $this->Body .= &#39;<body>&#39;;
                                $this->Body .= "\n";
                        }
                }
        
                function pgfoot()
                {
                $Device = new Device;
        
                        if($Device->Device == &#39;wml&#39;)
                        {
                            $this->Body .= &#39;</card></wml>&#39;;
                        }
                        if($Device->Device == &#39;xhtml&#39;)
                        {
                            $this->Body .= &#39;</body></html>&#39;;
                        }
                        if($Device->Device == &#39;html&#39;)
                        {
                            $this->Body .= &#39;</body></html>&#39;;
                        }
                }
        
                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.

        Comment


          #5
          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

          Comment


            #6
            awesome wizard 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.

            Comment

            Working...
            X