code not working, dont understand why

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
darknecromancer
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2004 12:59 am

code not working, dont understand why

Post by darknecromancer »

Ok, i'm trying to crate a little scipt, if thats what you call a php page ?? new to this, that will load defult settings so i dont have to enter all the vlink stuff every single new page. i just type the file and it loads the settings; heres the code.

The Loading Code:

Code: Select all

<?php
echo "<body bgcolor='BLACK' text='GRAY' link='GRAY' vlink='GRAY' alink='GRAY'>";
?>
The page i call it from:

Code: Select all

<?php
$call = include('call.php');
highlight_string("$call");
echo "testing";
echo "</body>";
?>
the page source looks like this:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<body bgcolor='BLACK' text='GRAY' link='GRAY' vlink='GRAY' alink='GRAY'></body>
</html>
<code><font color="#000000">
1</font>

</code>testing</body></body>
</html>
whats up???

also if anyone knows how to auto load the defults or an easier way to do it please give give :) thanks
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

inluce() doesn't return the contents of the file, so you don't want to do $call = include('code.php') as $call will be set to 1 (you can see the 1 in your output).

Just call the include at the point you want to see the <body stuff, e.g

Code: Select all

<html>
<head>
    <title>A Test</title>
</head>
<?php require_once 'code.php'; ?>
..some more html here...
</body>
</html>
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

btw just an advice, u should use css insteand of outputting your styles in the body
:)
defx
Forum Commoner
Posts: 36
Joined: Mon Feb 16, 2004 11:50 pm
Location: Florida, USA

Post by defx »

also, im not sure, but i dont think HTML supports the single quote.. try removing it :O
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

HTML supports anything :roll:

That's a problem,

Code: Select all

&lt;a href=google.com&gt;google&lt;/a&gt;
&lt;a href='google.com'&gt;google&lt;/a&gt;
and
&lt;a href="google.com"&gt;google&lt;/a&gt;
will all output google

also, try something along the lines of

Code: Select all

$call = file_get_contents("call.php");
$call = highlight_string($call);
echo $call;
echo "</body>\n</html>";
also, make sure to fopen the file before calling it. (i didnt add that because i dont remember the exact syntax ;), search php.net)
Post Reply