imajin8shun 0 Report post Posted July 1, 2005 (edited) I was just wondering (because php is to complecated for me, that and I'm lazy) if there was some kind of HTML to PHP converter out there somewhere? Something that could convert this: <head><style>input { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }textarea { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }</style><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><meta name="ProgId" content="FrontPage.Editor.Document"><title> title title</title><style type="text/css">A:link{color:8560A8; text-decoration:none;font-weight:bold;cursor:"nw-resize"}A:visited{color:8560A8;text-decoration:none;font-weight:bold}A:Hover { text-decoration: underline; text-decoration:; background-color:7CC576; font-weight:bold; CURSOR:crosshair;}</style><style>body { scrollbar-face-color: #000000; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-arrow-color: #000000; }</style> <style type="text/css">BODY, TR, TD { font-family:tahoma; font-color:7CC576; font-size: 8pt; text-align:; font-weight:normal; color:"7CC576"; }</style><META HTTP-EQUIV="imagetoolbar" CONTENT="no"></head><body bgcolor="black" topmargin="0" leftmargin="0"><div style="position:absolute;left:2;top:2;width:370px;"><img src="img1.jpg"></div><div style="position:absolute;left:372;top:20;width:340px;"><center> blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah <br><br><img src="img2.jpg">For general inquiries, feel free to <a href="mailto:mail@mail.com">contact me.</a></div><div layer="1" style="position:absolute;left:17;top:70;"><IFRAME name="_blank" src="middle.htm" frameBorder=0 width=338 height=320 style="border: 1pt solid black;"></IFRAME></div><div style="position:absolute;left:0;top:0;"></body> into PHP coding... Notice from m^: When you're pasting largish block of code, use the tag CODEBOX instead of CODE. It makes life much easier. Edited July 2, 2005 by microscopic^earthling (see edit history) Share this post Link to post Share on other sites
vujsa 0 Report post Posted July 2, 2005 I'm not entirely sure why you want to convert the HTML into PHP. If it is so that you can add more PHP to the HTML, then there are several ways to do that. I imagine that I could write a script that would convert normal HTML into PHP if you really wanted it.Here is what the output of such a script would look like: <?phpecho "<head><style>input { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }textarea { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }</style><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\"><meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\"><meta name=\"ProgId\" content=\"FrontPage.Editor.Document\"><title> title title</title><style type=\"text/css\">A:link{color:8560A8; text-decoration:none;font-weight:bold;cursor:\"nw-resize\"}A:visited{color:8560A8;text-decoration:none;font-weight:bold}A:Hover { text-decoration: underline; text-decoration:;background-color:7CC576; font-weight:bold; CURSOR:crosshair;}</style><style>body { scrollbar-face-color: #000000; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-arrow-color: #000000; }</style><style type=\"text/css\">BODY, TR, TD { font-family:tahoma; font-color:7CC576; font-size: 8pt;text-align:; font-weight:normal; color:"7CC576"; }</style><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"></head><body bgcolor=\"black\" topmargin=\"0\" leftmargin=\"0\"><div style=\"position:absolute;left:2;top:2;width:370px;\"><img src=\"img1.jpg\"></div><div style=\"position:absolute;left:372;top:20;width:340px;\"><center> blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah <br><br><img src=\"img2.jpg\">For general inquiries, feel free to <a href=\"mailto:mail@mail.com\">contact me.</a></div><div layer=\"1\" style=\"position:absolute;left:17;top:70;\"><IFRAME name=\"_blank\" src=\"middle.htm\" frameBorder=0 width=338 height=320 style=\"border: 1pt solid black;\"></IFRAME></div><div style=\"position:absolute;left:0;top:0;\"></body>";?> Like I said before, I don't know why you would eant to convert the existing HTML but that is how it would be done.Perhapes if you gave more information as to why you wanted to convert the code, then I could better assist you.vujsa Share this post Link to post Share on other sites
Houdini 0 Report post Posted July 2, 2005 vujsa said it first I wonder why you would want to use a server side script to take a client side markup. PHP can generate html and works real well with HTML forms and SQL databases, to learn the basics of it though is not that complicated and if you want to run a forum site learning PHP and some MySQL would not only be helpful but almost a necessity.If you ever find a converter to do what you want it would be more of a novelty than a practical tool. Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted July 2, 2005 There is also another method very similar to vujsa's that you can use. First of all, all php code begins with <?php and ends with ?> . The echo() command (which can be used with quotes instead of paranthesis) outputs text and html. If you place <<<END immediately after the echo tag you do not need to place quotes after echo and do not need to worry about palcing quotes in your html document, which you do if you place quotes after the echo function. Then, after you finish your html, place END; to end the echo command. It would look like this: <?phpecho <<<END<head><style>input { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }textarea { border: 1px solid orange; font-family: tahoma; font-size: 9pt; color: white; background: EE6006; }</style><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\"><meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\"><meta name=\"ProgId\" content=\"FrontPage.Editor.Document\"><title> title title</title><style type=\"text/css\">A:link{color:8560A8; text-decoration:none;font-weight:bold;cursor:\"nw-resize\"}A:visited{color:8560A8;text-decoration:none;font-weight:bold}A:Hover { text-decoration: underline; text-decoration:;background-color:7CC576; font-weight:bold; CURSOR:crosshair;}</style><style>body { scrollbar-face-color: #000000;scrollbar-highlight-color: #000000;scrollbar-shadow-color: #000000;scrollbar-3dlight-color: #000000;scrollbar-arrow-color: #000000;}</style><style type=\"text/css\">BODY, TR, TD { font-family:tahoma; font-color:7CC576; font-size: 8pt;text-align:; font-weight:normal; color:"7CC576"; }</style><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"></head><body bgcolor=\"black\" topmargin=\"0\" leftmargin=\"0\"><div style=\"position:absolute;left:2;top:2;width:370px;\"><img src=\"img1.jpg\"></div><div style=\"position:absolute;left:372;top:20;width:340px;\"><center> blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah <br><br><img src=\"img2.jpg\">For general inquiries, feel free to <a href=\"mailto:mail@mail.com\">contact me.</a></div><div layer=\"1\" style=\"position:absolute;left:17;top:70;\"><IFRAME name=\"_blank\" src=\"middle.htm\" frameBorder=0 width=338 height=320 style=\"border: 1pt solid black;\"></IFRAME></div><div style=\"position:absolute;left:0;top:0;\"></body>END;?> Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 2, 2005 vujsa if you could make that script it would be a good help. basically I wanted to make my site in php but i dont get it at all... the manual on phpfreaks is too long and i dont have all that time to read it. so i was just wondeing if their was some kind of tool that could change html into php so i can make my site in php. does that make sense? Share this post Link to post Share on other sites
sxyloverboy 0 Report post Posted July 2, 2005 i dont really think that there is a nescisary to do that if you have the html already. php can genereate diffrent sites with diffrent input from one source. uhm that explains it kinda badly but php is for dynamic stuff or for easying your programing and once you have learned it you save a ton of time when you code your websites. Share this post Link to post Share on other sites
overture 0 Report post Posted July 2, 2005 Based on what you have said why not just save the page with the *.php extension to make the file a PHP file?Do you actually want to add PHP code into the page? There is no need to echo out pure HTML using PHP it is pointless unless you want to dynamically change the HTML using variables, form input and what not.You only need to save pages with *.php file extension when you want to add PHP code into it. Like vizskywalker said PHP code starts with <?php and ends with ?> so there is no need to "convert" the HTML. Share this post Link to post Share on other sites
vujsa 0 Report post Posted July 3, 2005 imajin8shun, I thought that this was what you were wanting to do. It really doen't make any sense to convert the HTML into PHP if all you really want is to design your site in "PHP". Just simply taking your existing HTML and parsing it as PHP has no benefits. In fact, because the PHP engine will be called every time the page is loaded, it will actually slow the loading of your page slightly. But if you are dead set on designing your site with "PHP", then I highly recommend doing as overture suggested. Instead of naming your files index.html, name them index.php. This will give the appearence that your website was designed using PHP but in actuality, it is just regular html in disguise. When PHP is used to design web pages, it is used to create a page on-the-fly based on a set of variables. Many times these variables are stored in a database. Combining a database with PHP allows for the creation of dynamic websites like this forum or a search engine. While I am more than happy to write a script that would convert HTML to PHP in the most basic way, I really think that you should try to determine why you would want to do such a thing. To convert the HTML would require about 5 lines of very basic PHP and several lines of HTML. I think that you should make an attempt to actually learn PHP which will give you a better understanding of it's use in web design. vujsa Share this post Link to post Share on other sites
imajin8shun 0 Report post Posted July 3, 2005 lol I have just proven my lack of php knowledge in this thread lol. Basically, I heard php was an easier way of changing the content of your site, its layout and all that kind of stuff and I wanted to learn it so it would be easier. I guess I should re-read what phpfreaks had on their site about it and see if I can get a better understanding this time round. Thanks guys for all your help and if anyone knows of a good site that teaches you the basics in an easy to understand concept, let me know Share this post Link to post Share on other sites
vujsa 0 Report post Posted July 4, 2005 There are a few tricks you can use php for that might help you design your website. For example: If you wanted every webpage on your site to use the same basic layout or template, you could use PHP includes to insert HTML code fragments into your pages. Like if you wanted to have a really nice menu that would probably chane frequently and you wanted the menu on every page on your website then PHP can help. If you place the menu code into its own file and then include the contents of the file at the right place in your webpage, then every page would be the same and when you edit the menu file, it will change on every page in your website. This link may help a little with explaining what I am talking about. http://forums.xisto.com/topic/84998-topic/?findpost=1064310997 Now that I know that you are looking for this type of information, I think I can help you better. I suggest reading that topic first then starting a new topic in the PHP forum with a more specific question. You will find a lot of PHP support here as many of our members are familiar with PHP. Also, many of us learned PHP from books and online guides but learning by example seems to work the bet. Also, if your example doesn't have any real world use, I find it more difficult to learn the concept. If you ask how to do something in PHP here, I'm sure you'll get a good explaination of how to do it. The link above will show a very basic PHP function and you can add to that idea. For the complete guide to PHP try the PHP website at http://php.net/ It tends to be difficult to learn from but if you need to know what a particular PHP command does, this will explain its correct use. I suggest looking up the include function there. I hope to see your PHP questions soon. vujsa Share this post Link to post Share on other sites