|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
hi ppl
i'm in urgent need of an util like this... i gotta transform lot of HTML designs to print '.....'; and i'll become mad if i do it line per line... i saw this one, it is perfect, but its author doesnt want 2 give it http://quasarcr.com/html2php/ this one is nice too http://www.html2php.com/frahtm2php.html and this seems 2 work not so good http://www.linuxlogin.com/tools/html2php.php i got the perl script from hostscripts.com but dont have perl and wont install it 4 this... plz... does some1 have some of these nice scripts? thanks... A LOT
__________________
Enrique Becerra Mambo & Joomla Development - www.beza.com.ar MSN: qbecerra @ hotmail.com San Juan - Argentina |
|
#2
|
||||
|
||||
|
Moved to the Scripts forum from PHP.
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#3
|
||||
|
||||
|
Erm, can't you just do something like this (necessary PHP code inserted in bold text over the HTML)
Code:
<?
print <<<END_OF_HTML
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World!</h1>
Pick up your balls and load up your cannon<br>
For a 21 gun salute<br>
<i>For Those About To Rock (We Salute You)</i>
</body>
</html>
END_OF_HTML;
?>
As you can see, it works over multiple lines and thus you don't have to insert a print '...'; on each line of HTML. Also, you can put PHP variables in the middle and it'll interpolate them just fine. So, with this approach, all you have to do is insert the bold text at the top and bottom of any HTML file and voila! ![]()
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month Last edited by Scorpions4ever : September 25th, 2003 at 12:39 AM. |
|
#4
|
||||
|
||||
|
it worked great scrorpions4ever, but plz let me ask u now another question. i use lot of sending mail with php, and i want to do following:
$var = 'hello world!'; $html = ' <html> <head> <title>Hello World</title> </head> <body> <h1>Hello World!</h1> Pick up your balls and load up your cannon<br> For a 21 gun salute<br> <i>For Those About To Rock (We Salute You)</i> <br><br>$var </body> </html> '; but when i do echo 'this is the content<br>'.$html; I cannot see the $var's value... ![]() what da ya advice me to do in that case? itd be great i can make the html design with the vars & copy / paste like the 1st example u gave me... thanks |
|
#5
|
||||
|
||||
|
You should use double quotes(") instead of single quotes ' in this statment. i.e
$html = " ... $var "; instead of what you have now $html = ' ... $var '; Single quotes don't allow interpolated variables, i.e. they render the string as you see it. Double quotes allow interpolated variables, i.e. they replace all $ variables with the actual values. Better still, use <<<END_OF_HTML style coding instead. Why, you ask? - Well, if you had any double quotes in your html, you would have needed to escape them with a \ character. With the <<< style, you don't need to do that. The following code illustrates this: Code:
<?
$var = 'hello world!';
$html = <<<END_OF_HTML
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello World!</h1>
Pick up your balls and load up your cannon<br>
For a 21 gun salute<br>
<i>For Those About To Rock (We Salute You)</i><br>
Isn't this a great "test"
<br><br>$var
</body>
</html>
END_OF_HTML;
echo 'This is the content2<br>'. $html;
?>
Replace the END_OF_HTML code with single or double quotes and it won't work any more, since the HTML has " and ' within it (which you'll need to escape as \" and \\' to make them work). With END_OF_HTML style syntax, you don't have to escape them. BTW you don't have to call the tag as END_OF_HTML. You can use any string you like. Just remember the following simple rules: (a) The last END_OF_HTML should be on its own line with a ; at the end (b) The last END_OF_HTML; should have no leading or trailing spaces. That means no spaces after the ; (c) Match your tags. This means, if you do this $html = <<<FOO then your HTML code should end with a corresponding: FOO; [edit] Looks like the VB code doesn't render \\' correctly. You need to \\ it to work with ' and show up correctly on the forum[/edit] Last edited by Scorpions4ever : October 3rd, 2003 at 07:30 PM. |
|
#6
|
||||
|
||||
|
hey man...
what do u do to be SO quick & efficient? incredible, awesome, and im very thankful 2 ya great! still astonished... |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > html2php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|