Page 1 of 1

[Help] Convert HTML image code to PHP codes.

Posted: Fri Apr 25, 2008 10:13 pm
by JulieXP
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

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 3:46 am
by lafever
What exactly do you need PHP for this for?

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 4:44 am
by JulieXP
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.

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 4:48 am
by Chris Corbyn
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.

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 5:02 am
by JulieXP
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);
?>

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 5:16 am
by Chris Corbyn
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";

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sat Apr 26, 2008 5:21 am
by JulieXP
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!

Re: [Help] Convert HTML image code to PHP codes.

Posted: Sun Apr 27, 2008 6:41 pm
by codeblock
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'.';