PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JulieXP
Forum Newbie
Posts: 5 Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC
Post
by JulieXP » Fri Apr 25, 2008 10:13 pm
Hi everyone, I am having a very hard time trying to convert an HTML an image to work for PHP. I was hoping maybe someone here would be able to help me.
Below is the HTML code I'm trying to make work for PHP
Code: Select all
<a style="position:absolute;left:0px;top:0px;z-index:9999;" href="http://www.whytehouse.com/" target="_blank"><img src="http://www.whytehouse.com/Icon/flag-wave.gif" style="position:fixed;left:0px;top:0px" border="0"></a>
If you have time, would you assist me in this task?
Thanks,
-XP
lafever
Forum Commoner
Posts: 99 Joined: Sat Apr 05, 2008 2:03 pm
Location: Taylor, MI
Post
by lafever » Sat Apr 26, 2008 3:46 am
What exactly do you need PHP for this for?
JulieXP
Forum Newbie
Posts: 5 Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC
Post
by JulieXP » Sat Apr 26, 2008 4:44 am
I do not see why it would matter, but I need this for a script that i want to add on as a floating banner.
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sat Apr 26, 2008 4:48 am
JulieXP wrote: I do not see why it would matter, but I need this for a script that i want to add on as a floating banner.
There is nothing to convert. HTML and PHP live very happily alongside each other. You can't convert HTML to PHP since they are two different things. HTML is a markup language; PHP is a programming language.
Code: Select all
<?php $some = php_code($here); ?>
<a style="position:absolute;left:0px;top:0px;z-index:9999;" href="http://www.whytehouse.com/" target="_blank"><img src="http://www.whytehouse.com/Icon/flag-wave.gif" style="position:fixed;left:0px;top:0px" border="0"></a>
<?php some_more_php($code); ?>
All you have to do is drop out of the <?php ?> tags as shown above. We'd probably need to see the rest of your PHP code to understand your problem more.
JulieXP
Forum Newbie
Posts: 5 Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC
Post
by JulieXP » Sat Apr 26, 2008 5:02 am
I am trying to add the HTML from the first post on to line "22" in the php code below:
Code: Select all
<? session_start();
require_once('../functions.php');
$__url = "fuseaction=user.id=".$_POST['id'];
$__content = getUrlContent( $__url );
$__reg = '<style type="text/css">(.*)</style>';
preg_match_all( "|".$__reg."|isU",$__content,$arr );
for( $i=0;$i<sizeof($arr[0]);$i++ )
{
$cc .= $arr[0][$i]."\n";
}
$cc .= "<a href=\"".$host."\">Text Link Here</a>";
print_header("Pace","image.gif",1);
?>
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sat Apr 26, 2008 5:16 am
You need to stick a backslash before each double quote so that PHP knows it isn't the end of the string:
Watch our highlighter here. Strings are supposed to be red:
Code: Select all
$good_string = "here is a \"string\" with doube quotes";
$bad_string = "here is a "string" with double quotes";
JulieXP
Forum Newbie
Posts: 5 Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC
Post
by JulieXP » Sat Apr 26, 2008 5:21 am
Ahh, yes, thank you! This was the problem I was having. It keep closing the code and I was unsure on how to get it working. Thanks again!
codeblock
Forum Newbie
Posts: 4 Joined: Sun Apr 27, 2008 5:26 pm
Location: USA
Post
by codeblock » Sun Apr 27, 2008 6:41 pm
or use single quotes.
like:
Code: Select all
$string = 'this is a string with "quotes" in it';
thats fine, but then you have to use concatations for variables:
Code: Select all
$variable = 4;
$string = 'Two "plus" two is '.$variable'.';