View Full Version : Some sort of php tag, that allows FULL html?
DrkFusion
01-07-2003, 10:28 PM
As you know in php, you can't use double quotes without putting for ex:
<input type=\"text\" name=\"head\">
Is there some sort of php tag, or function that you can use to parse html normally?
With the double quotes and all?
like
fullhtml("html here");
*note i made up that above :p
DrkFusion
01-07-2003, 10:30 PM
Also
what is
htmlentities()
?
NTLDR
01-07-2003, 10:42 PM
Originally posted by DrkFusion
Also
what is
htmlentities()
?
It converts things like " to " and & to & in strings, although its seems you should use htmlspecialchars(); if your not using ISO8859-1 acording to PHP.net
Xenon
01-08-2003, 04:11 PM
Arunan, if you use ' ' around the String then you can use " in it :)
filburt1
01-08-2003, 04:45 PM
Originally posted by Xenon
Arunan, if you use ' ' around the String then you can use " in it :)
but (IIRC) you then won't get variables parsed; i.e., if $test is 1, then echo 'test is $test' will not echo test is 1.
DrkFusion
01-08-2003, 06:24 PM
Well I want to use normal html, no editing, with the double quotes and all, basically its like me writing normal html in a html page, but I want to incorporate it in php, what function would allow me to put html into it without having to format the html to fit php's needs.
poi@nwdnb
01-08-2003, 06:35 PM
You are probably aware of this, but just drop out of PHP code completely..
<?php
some.php.code.here();
?>
<html>
here is the html code
the value of $variable is <?=$variable?>
</html>
<?
more.php.code.here();
?>
And use the php echo() shortcut syntax to return the values of variables ie. <?=$somevariable?> (just enclose the variable inside of <?= ... ?>
Note to use this echo() shortcut you must have the short_open_tag configuration directive enabled.
I do not know of any specific function that would allow raw html code to be echo'd back to the browser. This is just the way this type of embedded code forces us to work i think!
Velocd
01-09-2003, 01:32 AM
Untested, but try using:
$example = addslashes("<input type="text" name="head">");
Or maybe some variation of this will work.
Also untested, but there are two PHP directives in your php.ini file known as magic_quotes_gpc and magic_quotes_runtime, that basically will automatically add and strip slashes for you.
DrkFusion
01-09-2003, 11:05 AM
Parse error: parse error, unexpected T_STRING in /home/virtual/site19/fst/var/www/html/vbnews.php on line 2
Thats the error I get, Velocd :(
DrkFusion
01-09-2003, 11:05 AM
$example = addslashes('<font face="verdana" color="#000000" size="2">Hi</font>');
echo "$example;
Works...YAY :) Thanks Guys!
DrkFusion
01-09-2003, 11:07 AM
Why does stuff like $example = addslashes('<table><tr valign="top"><td>HI</td><td>Hi</td></tr></table>');
Not work :(
Xenon
01-09-2003, 11:13 AM
just try this:
$example = '<table><tr valign="top"><td>HI</td><td>Hi</td></tr></table>';
DrkFusion
01-09-2003, 06:59 PM
Gives me Parse error: parse error, unexpected $ in /home/virtual/site19/fst/var/www/html/vbnews.php on line 5
DrkFusion
01-09-2003, 06:59 PM
Wait it works :)
Xenon
01-09-2003, 07:57 PM
well, as i said :)
i think in vb3 code all strings are with ' '.
in vb2 there are some combinations..
DrkFusion
01-09-2003, 08:50 PM
Ah...very cool :)
Thanks again, yet another thing I have learned from you :-p
Kriek
04-20-2003, 02:14 PM
<?php
$message = 'Hi there';
echo '<table><tr valign="top"><td>' . $message . '</td></tr></table>';
?>
Keep in mind that a good way of organizing your print and echo statements is by concatenating strings. The whole point of double quotes is to allow interpolation. Personally I prefer inline html over echo.
<?php $message = 'Hi there'; ?>
<table><tr valign="top"><td><?=$message?></td></tr></table>
Can't you also do:
<?php
$somevar="http://www.apple.com/";
echo <<< DONE
<a href="$somevar">asdf</a>
DONE
?>
Kriek
04-26-2003, 12:38 AM
Yes, but you will retain a significant performance hit through larger scripts if you do.
Don't forget the semi-colon ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.