|
|
PHP Include only works from the outside?
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
I got this news portal script for my Vbulletin forum. It takes a predefined forum, and grabs the first post in each and sticks it into a page, as news items. It works really nice, except...
I can only include it using its full URL ( http://) when I try to include it locally, I get no output. Very strange. And when I copy all its code and paste it directly into my index file, it still doesn't output. The only way I can get any output is to call or link to the file via its full URL. The problem with this is that it is very very slow to load the page that way. The author said that thats the way the script works, it outputs a whole page and therefore can't be included. But that doesn't make any sense to be at all. I viewed the source of the file when called directly and it doesn't even output html or body tags, just the table tags that it creates and thats it! Its getting very annoying, the author also tried to help me get it working but there must be some sort of communication barrier because he doesn't seem to ever understand what I'm telling him. Does anyone else have any ideas about this situation? I can post the script if needed. Thanks.
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Aug 2002
Location: North Carolina's Triangle
Status:
Offline
|
|
Too many possible problems. Post the script, but only if it's all right with the person who created the script. And be as specific as you can as to what you've done and what you'd like it to do.
Alex.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Code:
<?
// Simple Newsportal & Threads overview hack
// Copyright by KuraFire, 2002 :)
// With extra credit to PPN for the permissions section
$templatesused = 'newsportal,newsportal_threadbit,newsportal_newsbit';
include('/webfolder/fellsbiker/forum/global.php');
// These variables define your newsforum, limit of newsposts,
// limit of threads, and forums to exclude in the threadlisting
$newsforum = 17;
$newslimit = 4;
/* ### NEWS SECTION ### */
$newsql = $DB_site->query("SELECT thread.threadid as tid, thread.title as ttitle, thread.replycount as treply, thread.postusername as user, thread.postuserid as userid, thread.dateline as dateline, post.pagetext as pagetext FROM thread LEFT JOIN post USING (threadid) WHERE forumid=$newsforum GROUP BY thread.threadid ORDER BY thread.threadid DESC LIMIT $newslimit");
while ($news=$DB_site->fetch_array($newsql)) {
$userid=$news['userid'];
$pagetext=$news['pagetext'];
$message=bbcodeparse2($pagetext,"1","1","1","1");
$user=$news['user'];
$threadid=$news['tid'];
$title=$news['ttitle'];
$replycount=$news['treply'];
$dateline=$news['dateline'];
$dateposted = date("F jS, Y",$dateline);
if ($replycount == 1){
$replies = $replycount . " reply";
} else {
$replies = $replycount . " replies";
}
eval("\$newsbits .= \"".gettemplate('newsportal_newsbit')."\";");
}
eval("dooutput(\"".gettemplate("newsportal")."\");");
?>
This script goes in my forum's folder. The way I have it set up now, is that that main page of that site calls an include() that calls the full URL path of that file, instead of just calling "forum/newsportal.php". When you call it locally, you get no errors and no output of the script. The page also loads very slowly. And I think it will be noticeably faster if I can call it from a local path. Right now when I load the page my stats show two distinct users to the page at once, one from my internal local IP (loading the index page) and one from my external IP (loading the newsportal page from its full URL)
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Aug 2002
Status:
Offline
|
|
what does the file 'global.php' look like?
by calling it from outside you are executing php on it (so if there are php tags in that file they will be evaluated by php.)
try replacing that line with:
eval('/path/to/global.php');
--will
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
whats the difference between eval and include?
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Aug 2002
Status:
Offline
|
|
the difference between eval and include is that eval will work on a string, while include works on a file.
it's hard to figure out what isn't working without seeing at least part of the file global.php
--will
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
global is where vbulletin stores all its info/data i believe, but I don't think it that has much to do with the problem. I don't think. I don't know maybe I'm wrong. Global is also a very big file, and its a commercial script so I don't think I can post it on the web either. My news portal is just an add on I'm trying to get to work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|