[Help] Convert HTML image code to PHP codes.

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

Post Reply
User avatar
JulieXP
Forum Newbie
Posts: 5
Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC

[Help] Convert HTML image code to PHP codes.

Post 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
User avatar
lafever
Forum Commoner
Posts: 99
Joined: Sat Apr 05, 2008 2:03 pm
Location: Taylor, MI

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

Post by lafever »

What exactly do you need PHP for this for?
User avatar
JulieXP
Forum Newbie
Posts: 5
Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC

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

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post 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.
User avatar
JulieXP
Forum Newbie
Posts: 5
Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC

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

Post 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);
?>
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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

Post 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";
User avatar
JulieXP
Forum Newbie
Posts: 5
Joined: Fri Apr 25, 2008 10:04 pm
Location: NyC

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

Post 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!
codeblock
Forum Newbie
Posts: 4
Joined: Sun Apr 27, 2008 5:26 pm
Location: USA

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

Post 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'.';
 
Post Reply