Log in

View Full Version : File Path



Pieings
11-02-2009, 04:39 PM
Apparently on my webhost Php Include isnt the best way for me add radio stats to my site

the web host said i need to do a Full File Path

How do i do this?

Joe!
12-02-2009, 05:06 PM
just include('path/to/file/radiostats.php'); in your php file will do fine. don't know what your webhost is on about.

Iszak
12-02-2009, 06:13 PM
When they said full path they probably meant real path. You can get that by the following.


$path = realpath('./');
include $path.DIRECTORY_SEPARATOR.'folder'.DIRECTORY_SEPAR ATOR.'file.php';
You don't have to use the constant "DIRECTORY_SEPARATOR" if you know what operating system you're on but it's good if it's going to transits from Windows to Linux. For example my include path would be like C:\XAMPP\htdocs\folder\file.php

Pieings
12-02-2009, 06:37 PM
Tech Hosts said this to me when i asked how to do radio stats

"You'd need to include them through the full path of the file, for example:
/home/yourcpanelusername/public_html/stats/radio_stats.php


I think My file path is
/home/icehabb1/public_html/radio_stats.php

But is there any other code that goes around it?
Ive used the php include it doesnt seem to work..
well nothing comes up just blank
the radio stats on my file are working when i view it
just getting them on my actual site is being a pain :P

Agnostic Bear
12-02-2009, 06:57 PM
When they said full path they probably meant real path. You can get that by the following.


$path = realpath('./');
include $path.DIRECTORY_SEPARATOR.'folder'.DIRECTORY_SEPAR ATOR.'file.php';
You don't have to use the constant "DIRECTORY_SEPARATOR" if you know what operating system you're on but it's good if it's going to transits from Windows to Linux. For example my include path would be like C:\XAMPP\htdocs\folder\file.php

Just use / it works on Windows as well.

Iszak
12-02-2009, 09:23 PM
Better to get in a good habit now, you don't want to go using / on window system commands. But I guess if you really want to make it look 'pretty' you can use / on your includes.

Dentafrice
12-02-2009, 09:28 PM
/ on system commands work just fine. So it's not really a 'bad' habit..

Want to hide these adverts? Register an account for free!