1 (edited by BC 2006-04-23 19:10)

Topic: problem with integration

Hi!

I have a CMS, on the index.php in a box I want to show the 10 newest topics

$action="active";
$show=10;

include($_SERVER['DOCUMENT_ROOT'].'/forum/extern.php');

however, I have the following erros message

The file 'config.php' doesn't exist or is corrupt. Please run install.php to install PunBB first.

What should I do to have the 10 newest topics on my frontpage

2

Re: problem with integration

any ideas?

Re: problem with integration

Check your config.php, remake it if neccessary

4

Re: problem with integration

well, thanks, this was my guess, but I do not know WHATI  should  revise in it?

Re: problem with integration

The index.php is from the CMS, not PunBB?
And extern.php is in the same folder as a properly working config.php?
And you do realize your variables won't do anything, right?

6

Re: problem with integration

index.php belongs to the cms
forum is outsite the directory of the cms like

root/forum -> place of the forum
root/cms/index.php place of the index file of the cms

forum alone is working fine, no problem, if I call the last 10 topics from a php which is inside the forum directory, it works fine

"And you do realize your variables won't do anything, right?" I am sorry, I cannot fully understand this, though I know the words :-)

Re: problem with integration

$action="active";
$show=10;

include($_SERVER['DOCUMENT_ROOT'].'/forum/extern.php');

won't work wink What you could do is this:

$action="active";
$show=10;

include($_SERVER['DOCUMENT_ROOT'].'/forum/extern.php?action='.$action.'&show='.$show);

Now, for your problem, it's best to put them all in the same foder, else PunBB won't handle it too well wink

Re: problem with integration

elbekko wrote:
$action="active";
$show=10;

include($_SERVER['DOCUMENT_ROOT'].'/forum/extern.php');

won't work wink What you could do is this:

$action="active";
$show=10;

include($_SERVER['DOCUMENT_ROOT'].'/forum/extern.php?action='.$action.'&show='.$show);

Now, for your problem, it's best to put them all in the same foder, else PunBB won't handle it too well wink

That won't work at all tongue
As I've said many times before, you can NOT add $_GET variables to a file on the local filesystem

9 (edited by BC 2006-04-25 22:30)

Re: problem with integration

:-( this would mean that I would have like 30 subdirectories in one directory (CMS + Forum + other things) this would become too complicated
there must be some other solution

for instance, what if I say in a php within the forum directory $top10 = "$_SERVER['DOCUMENT_ROOT'].'/forum/extern.php?action=active&show=10)

I now only have to access this variable from outside the directory, could this work?

10 (edited by Smartys 2006-04-25 22:43)

Re: problem with integration

You can NOT add $_GET variables to a file on the local filesystem tongue
Use the URL to extern.php

11

Re: problem with integration

but that does not work... do you have any ideas apart from reinstalling the forum inside the directory of the CMS

Re: problem with integration

include("../forum/extern.php?action=active&show=10");

Does that work?

13

Re: problem with integration

no, it says "there is no config.php or new installation redirecting in 3 seconds" or something

Re: problem with integration

Is there a config.php in the /forum directory?

Re: problem with integration

elbekko wrote:
include("../forum/extern.php?action=active&show=10");

Does that work?

How many times do I have to say it?
You can NOT include $_GET variables via include

16

Re: problem with integration

ok, we all understand that, BUT can you say how to solve this problem? I mean, apart from reinstalling...

Re: problem with integration

Why would reinstalling do anything?
You can not include extern.php when the file including it is not in the same folder as extern.php
You also can not use $_GET variables in a local filename
So, the fix is to call it via its URL (the way you would see it in a browser)

18

Re: problem with integration

many servers do not allow including php files outside their root directory.... if I use http:// it will not work

19

Re: problem with integration

"URL file-access is disabled in the server configuration" . . .

20 (edited by Smartys 2006-04-26 23:13)

Re: problem with integration

Then it can't be included via PHP

However, if you really must, here's the way to do it:
Open extern.php

FIND

define('PUN_ROOT', './');

REPLACE WITH

if (!defined('PUN_ROOT'))
    define('PUN_ROOT', './');

Then, add the following code to your page (where you want to include extern.php):

define('PUN_ROOT', $_SERVER['DOCUMENT_ROOT'].'/');
$temp_get = $_GET;
$_GET = array();
$_GET['action'] = 'active';
$_GET['show'] = '10';
include $_SERVER['DOCUMENT_ROOT'].'/forum/extern.php';
$_GET = array();
$_GET = $temp_get;

Adjust paths as necessary wink

21

Re: problem with integration

hi!

works fine, thank you very much, BUT i have a warning message:

this is what I use:

extern.php:

- I have removed the exit command for not correctly defined install

if (!defined('PUN_ROOT'))
    define('PUN_ROOT', '/usr/local/www/data-dist/testsite/forum/');

and in the index.php where I want the list to appear

  <?php define('/usr/local/www/data-dist/testsite/forum/');
$temp_get = $_GET;
$_GET = array();
$_GET['action'] = 'active';
$_GET['show'] = '10';
include '/usr/local/www/data-dist/testsite/forum/extern.php';
$_GET = array();
$_GET = $temp_get;
?>

the topics show up BUT i have this message

Warning: Wrong parameter count for define() in index.php (the page where I have included the call for extern.php)

any ideas?

22

Re: problem with integration

i have deleted this: define('/usr/local/www/data-dist/testsite/forum/')

and now it works fine

23 (edited by Smartys 2006-04-27 15:31)

Re: problem with integration

Err, I didn't mean adjust in extern.php
That should still have the correct define within the if statement, as I gave it