View Full Version : how do i fix this ?
GregT
February 1st, 2003, 14:08
ok im writting my site in php, but i got a little problem with the news page, it keeps putting the text at the very top !
Ex. http://www.yupadog.com.
here's my code for it
else { $news = include("news.txt"); top_html(); body($page,$news); bottom(); }
Cagez
February 1st, 2003, 14:19
Mabe when your calling the include it's not working as you want it to (by going into the variable) try loading the file into the variable like this
<?php
$fh = fopen("news.txt","r");
$news = fread($fh,filesize("news.txt"));
?>
Edit: oops, i put people.txt on accident :biggrin2:
ECTrimble20
February 1st, 2003, 18:44
else {
$fh = fopen("news.txt","r");
$news = fread($fh,filesize("news.txt"));
top_html();
body($page,$news);
bottom();
}
In other words like that.
spec
February 1st, 2003, 18:46
Dude I do not believe you can store a include in a variable.
conkermaniac
February 1st, 2003, 23:04
Originally posted by spec
Dude I do not believe you can store a include in a variable.
Yeah, that's what I was wondering.
Cagez
February 1st, 2003, 23:25
Originally posted by spec
Dude I do not believe you can store a include in a variable.
I don't think so either, but the code I said should work.
GregT
February 2nd, 2003, 11:08
This is quite odd
Fatal error: Call to undefined function: fopen() in /srv/sites/yupadog/www/index.php on line 114
Any idea why ?
Cagez
February 2nd, 2003, 11:32
I hate error messages :D
What was the line that the error returned?
Thats weird, those errors only return when your calling a function, well, that isn't defined lol But it is defined! (http://www.php.net/manual/en/function.fopen.php)
I'm confused... Your on PHP at least 3 right? Read the comments posted at PHP.net for the function --mabe you made a mistake hile setting up PHP (if you did set it up yourself)?
:confused2
GregT
February 2nd, 2003, 12:26
PHP 4.1.6 i belive, if i put a php info up would that help ?
Cagez
February 2nd, 2003, 13:48
Do you have safemode on? Yeah, post up phpinfo, mabe its somethin in there...
Canuckkev
February 2nd, 2003, 14:21
Maybe a syntax error somewhere caused this? I don't know, that error message is strange...
Maybe post more of the code, specifically lines 110-120
Cagez
February 2nd, 2003, 15:01
I was thinking mabe it was an error with fread, the fopen handle didn't work properly, but its saying that fopen isn't even a function... Weirds :chinese2:
GregT
February 2nd, 2003, 15:55
Newer than i thought 4.2.2
http://yupadog.com/info.php
GregT
February 2nd, 2003, 21:26
i've tried to rewrite my code into perl, but ended up with this
http://www.yupadog.com/cgi-bin/index.cgi
here's my code
#!/usr/bin/perl
#######################################
## Yupadog.com v5.2 ##
## Copyright 2002 - 2003 Greg Helton ##
## All Rights Reserved ##
#######################################
## Settings ##
$logo = "/logo.png"; ## Replace with site logo name
$title = "Y.D. 5.2"; ## Site Title (<title></title>)
$head = ""; ## Place any html to be inserted into <head>
## Site Parts ##
sub top_html() {
print <<HTMLEND;
Content Type: html/text
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>$title</title>
<style type="text/css" media="all">@import "http://www.yupadog.com/ababa.css";</style>
$head
</HEAD>
<body class="bbcccc" bgcolor="#ffffff">
<table align="center" width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<p class="top"><center><img src="$logo"></img></center></p>
<p class="nav"><a href="index.php?page=about">About</a> | <a href="index.php?page=gallery">Gallery</a> | <a href="/ubb/ultimatebb.php">Forums</a> | <a href="index.php?page=scripts">Scripts</a> | <a href="index.php?page=hosting">Hosting</a> | <a href="index.php?page=links">Links</a> </p>
</td></tr>
<tr valign="top">
HTMLEND
}
sub body($name,$content) {
print <<HTMLEND;
<td nowrap>
<p class="ctr">$name</p>
$content
<p class="boxtop"></p>
</div></td></tr>
HTMLEND
}
sub bottom() {
print <<HTMLEND;
<tr><td colspan="2">
<br><div class="mouse">Wanna tell me a question or comment on my site ? <a href="mailto:greg@total-host.net">greg@total-host.net</a><br>
Copyright © 2002-2003 Greg Helton.<br><a href="http://www.suse.com" target="_blank"><img src="powered_by_suse.gif" alt="Powered by SuSE Linux 8.1"></a></div>
</td></tr>
</table>
</body></html>
HTMLEND
}
## Site ##
$uncstr = '<blockquote> Sorry, this page is Under Construction !</blockquote>';
if($page == "about") {
top_html();
&body($page,$uncstr);
bottom();
}
if($page == "scripts") {
top_html();
&body($page,$uncstr);
bottom();
}
if($page == "hosting") {
top_html();
&body($page,$uncstr);
bottom();
}
if($page == "links") {
top_html();
&body($page,$uncstr);
bottom();
}
else {
$news = "hi";
top_html();
&body($page,$news);
bottom();
}
Cagez
February 3rd, 2003, 16:08
Well raz0r, I really don't know... I even asked for you on PHP Builder and no one really said anything that would help, one guy said you had safe mode on, but it isn't.. As for your Perl code, haven't a clue, haven't done Perl in a while... The only thing I see is mabe you don't need to put Content Type: html/text in each and every function, just print it at the top of the script, once.
GregT
February 4th, 2003, 16:05
Nevermind i found an easier way :o
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.