Page 1 of 1

code not working, dont understand why

Posted: Tue Feb 17, 2004 12:59 am
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

Posted: Tue Feb 17, 2004 4:54 am
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>

Posted: Tue Feb 17, 2004 9:16 am
by Draco_03
btw just an advice, u should use css insteand of outputting your styles in the body
:)

Posted: Tue Feb 17, 2004 9:42 am
by defx
also, im not sure, but i dont think HTML supports the single quote.. try removing it :O

Posted: Tue Feb 17, 2004 10:23 am
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)