FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FudApi
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
FudApi [message #161707] Sun, 31 January 2010 17:28 Go to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
I have setup a forum and am wanting to use the fudapi on my home page.

As of now, I have domain.com/forum as the home to my forum.

On domain.com/index.php I want to use include the fudapi.inc.php (which has already been configured to include GLOBALS.php). The problem I am having is my domain is on cloud hosting. Because of this, I have a ROOT folder (named web in this case) which is not . Inside this folder, I have a content folder(similar to www, htdocs, and public_html on other hosts) and I have create the FUDForum folder here to house the cache, errors, files, etc.

The content folder is where index.php and the forum directory lives. What is the best way to be able to include the anything inside the FUDForum directory without compromising security?
Re: FudApi [message #161709 is a reply to message #161707] Sun, 31 January 2010 18:47 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Not sure I understand the question. Isn't there just one way to do it - include('/path/to/include/file.php')?
Re: FudApi [message #161710 is a reply to message #161707] Sun, 31 January 2010 18:53 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
Yes, but the problem is the index.php lies within the web/content directory (the directory that is opened when you go to domain.com) and the forums I want to include are in web/FUDForum. There is no way to include files in this directory.

In the index.php, I have tried include ('../FUDForum/scripts/fudapi.inc.php'); but it can't find it.

Is there a safe way to include these fudapi in a file that is not in the same directory as the FUDForum?
Re: FudApi [message #161712 is a reply to message #161710] Sun, 31 January 2010 19:11 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
If the relative path is valid and PHP can read the file you should be OK. Try to unlock the forum's files to see it it helps.
Re: FudApi [message #161714 is a reply to message #161712] Sun, 31 January 2010 19:42 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
Still not working.. I was able to include the files now, but when i try to use a function from the api, it stops rendering the page where the function is called..

Is there a way i can see if the files have actually been included?

For example, I have the following code:
<?php 
include_once '../path/to/fudapi.inc.php';
include_once '../path/to/GLOBALS.php'; 
echo "Top poster: ". fud_fetch_top_poster()->alias ."\n";
?>


I put it in the content div of my page.. everything renders up until that code is called, then the loading of the page is stopped
Re: FudApi [message #161715 is a reply to message #161714] Sun, 31 January 2010 20:35 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Add the following debugging code to the script to see what's happening:

error_reporting(E_NOTICE | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
ini_set('display_errors', '1');
ini_set('display_startup_errors', 1);
Re: FudApi [message #161716 is a reply to message #161715] Sun, 31 January 2010 20:38 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
GLOBALS.php should be loaded first. The correct code will be:

<?php 
include_once '../path/to/GLOBALS.php';
include_once '../path/to/fudapi.inc.php';
echo "Top poster: ". fud_fetch_top_poster()->alias ."\n";
?>
Re: FudApi [message #161717 is a reply to message #161707] Sun, 31 January 2010 20:41 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
I put in that code and nothing renders still.. quits when it hits that section of php code so I can't even get an error message
Re: FudApi [message #161718 is a reply to message #161707] Sun, 31 January 2010 20:44 Go to previous message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
WOW! sorry to take your time.. it was a stupid mistake on my part.. GLOBALS.php is in a directory named include.. i had includeS

Thanks for the help.. man, i feel stupid Embarassed
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Google Analytics Code?
Next Topic: Twitter integration?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 11 22:06:14 GMT 2024

Total time taken to generate the page: 0.02354 seconds