![]() | |||||||
Need help with calling a file. - php include I got a directory installed within xytheme.com. I want to call the stats and put it on my main blog. As you can see from www.xytheme.com, there is a sidebar there and I want to put my directory stats on it. This theme is not a widget ready so everything has to be coded. I don't really good in coding, a simple task is ok though. Can you suggest me anything to make this work? So far, I tried to use Code:
Then, I create a file called "dir_stats.php" and write in it the code above. I called "dir_stats.php" in below code but still the same. Anyone can help? Below are my sidebar.php code. Code:
|
Can't you just hardcode it? Possibly something like /home/you/public_html/directory/stats_main.php ? Dan |
Dan, How to insert that? Is it like this? Code:
I can't make this to work. Thanks. |
PHP Code: |
If your file is located in a different directory try something like this if it's within your current working directory: PHP Code: If it's above your current working directory use something like this (../ takes you back a directory, you can use this multiple times to go back multiple directories) PHP Code: That is provided that your file is 2 directories back. Finally you could try something like this if the file is a directory (or more) back but in another directory: PHP Code: -RageD |
Will start at the beginning of the filesystem. To get to a directory above the current working directory you'd just have 'dir/stats_main.php' or './dir/stats_main.php'. |
My stats file is at this location: Code:
My sidebar file located at: Code:
So? is this how the code will looks like? Code:
[EDITED] okay, that doesn't work. I use this and it seems to get the file. Code:
But, there is problem getting the file. Code:
|
It's getting the file fine, but there's a few problems with the code in stats_main.php and config.php. In the stats file, you have it starting a session. Sessions can only be started before any output is sent to the browser. To fix that problem, take session_start() from stats_main.php and put it at the beginning of your main file. You also have some parse errors in your config.php file. Parse errors are generally minor problems with how your code is structured. |
I can't just take it off from the file. The file is actually a file from indexscript directory. Seems like there is no way of doing this no? |
It's possible, you just have to edit the code a bit. |
I can't really see how your files are setup so this makes it a little more difficult to attack the problem unfortunately. What errors are you still receiving? (I mean have you made any changes since last post?) -RageD |
i think just include method can resolve your problem |
| All times are GMT -7. The time now is 08:09 PM. |
Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0