11:59:59 PM
Wednesday
Sep 08
Su M Tu W Th F Sa
567891011
12131415161718
19202122232425
262728293012
3456789

Play My Typing Game

View Some of My Artwork

My html to php
I worked with someone's templating system once, and it really opened my eyes on perhaps better way, if not a best practice to building sophisticated web appliations. This is a module for the templating system I've been producing for awhile now. Just add "echo $pg_content;" at the EOF and save to file to see this application run dry. This application is a handy tool when converting solid HTML/xhtml (containing javascript and/or css) to this pure php approach utilizing a string var named $pg_content. This application is not intended to convert a html/php hybrid application to pure php aimed for the templating system.

<?php
if($_POST['task']=="process")
{
        $pieces = explode("\r\n", $_POST['html']);
        $php = '';
        for($i=0;$i<count($pieces);$i++)
        {
                $php .= str_replace('"', '\"', $pieces[$i])." \r\n";
        }

        $pg_content .= "PHP Output: <small>Click to select all</small><br/>";
        $pg_content .= "<textarea cols=\"60\" rows=\"8\" name=\"php\" onclick=\"this.select();\">".$php."</textarea>";
        $pg_content .= "<br/><br/><br/>";
}




        $pg_content .= "<form method=\"post\" action=\"".$_SERVER['SCRIPT_NAME']."\">";
        $pg_content .= "<input type=\"hidden\" name=\"pg\" value=\"".$_SESSION['pg']."\" />";
        $pg_content .= "<input type=\"hidden\" name=\"task\" value=\"process\" />";
        $pg_content .= "Input HTML:<br/>";
        $pg_content .= "<textarea name=\"html\" cols=\"60\" rows=\8\"></textarea><br/>";
        $pg_content .= "<input type=\"submit\" value=\"Process\" />";
        $pg_content .= "</form>";
?>


Read Previous:
JavaScript version of PHP's number_format
Read Next:
Introduction to the shell
Table of Contents


Give a listen to my music...
My Best Recordings
How my services and skills can help you:
  • Global (via Email/Skype/AIM(ichat)/Yahoo)
    • Web Development Consulting
    • Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
    • Cellphone App Development (Android/MobileWeb)
    • Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
    • Music - Soundtrack Composition & Voice Work
  • Local
    • Most all the above, but also:
      • Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
      • Recording Live Music Audio
      • Video Streaming live music and other live events anywhere that can provide wifi
      • Training Video Streaming to your venue's trusted soundperson
Skills:
  • Global (via Email/Skype/AIM(ichat)/Yahoo)
    • Web Development Consulting
    • Custom Web App Development (PHP/MySQL/jQuery/CSS) Cross-Browser & OS
    • Cellphone App Development (Android/MobileWeb)
    • Music Lessons & Education for Beginner Guitar, Piano, Bass, which transfers over to many other instruments I am comfortable playing but not yet at teaching.
    • Music - Soundtrack Composition & Voice Work
  • Local, Most all the above, but also:
    • Music Performance (Harp, Voice, Guitar, Piano, Bass, Latin Percussion)
    • Being your venue's soundman
    • Video Streaming live music and other live events anywhere that can provide wifi
    • Training Video Streaming to your venue's trusted soundperson