Images not showing up and some links are wrong...PHP Script

I’ve been having a tough time figuring this out although for some reason I feel it should be easy to figure out even though I’m a beginner in PHP.

I uploaded a MySpace resource script to it’s own folder… /myspace

But when I go to the URL where it is…


The images aren’t showing up and some of the links are wrong. The images and links are missing the /myspace/ folder path.

I have tried several things which haven’t work out. For some reason I think it has something to do with thr ROOT_DIR settings in the config.php file.

I’ve included the config.php and indexs file below. Let me know if you need anything else.


// database param
define(‘DB_TYPE’, ‘******’);
define(‘DB_SERVER’, ‘******’);
define(‘DB_USER’, ‘******’);
define(‘DB_PASSWORD’, ‘******’);
define(‘DB_DATABASE’, ‘******’);

// set
define(‘SITENAME’,‘Myspace Codes’);
define(‘SHOWPIMP’,‘ON’); //ON or OFF show left-top

define(‘ROOT_DIR’, realpath(dirname(FILE)));

$mysql_server = DB_SERVER;
$mysql_user = DB_USER;
$mysql_pass = DB_PASSWORD;
$mysql_db = DB_DATABASE;

$strDBServer = $mysql_server;
$strDBUser = $mysql_user;
$strDBPass = $mysql_pass;
$strDBName = $mysql_db;
$strPath = $site_url;

$site_name = SITENAME;
$site_url = HOMEPAGE;

$strFPID = “******”;
$strFPName = "******
$strFPAge = “******”;
$strFPQuote = “******”;
$strFPImage = “******”;


define(‘APPS’, ‘./apps’);
//define(‘VIEWS’, ‘./view’);
$app = !empty($_GET[‘app’]) ? strtolower($_GET[‘app’]) : ‘home’;
$action = !empty($_GET[‘action’]) ? strtolower($_GET[‘action’]) : ‘index’;

require_once APPS . “/$app/{$app}_entrance.php”;
require_once APPS . “/$app/$action.php”;
//@include VIEWS . “/$app/$action.html”;

$output_content = ob_get_clean();

$title .= ’ - MySpace Codes, MySpace Editor, MySpace Generators - '.SITENAME;
$desc .= " - We have MySpace Editors, MySpace Layouts, MySpace Codes, MySpace Generators and MySpace Graphics, Ultimate One stop MySpace Resource!";
require ‘./layouts/’ . ( @$layout ? $layout : ‘default’ ) . ‘.php’;

My guess is that the problem is HTML and not PHP related. Take a look at the generated source and double check the paths printed in there. If the image path begins with a slash, domain root is used.

It’s a little hard to help more with so little details.

Yeah, it’s going to the root for the image path and not /myspace/ folder which I uploaded it to.

Does that mean the script will only work if I upload it to the root? Is there a way to set the root_dir as /myspace/ ??

Or I will have to manually input /myspace/ into several hundred files to make it work in the folder.

If your image tag looks like this:

<img src="foo.jpg"/>

There should be no problem.

It has /img/ folder path…

<img src="/img/friendspace.gif"

The problem I think is it’s looking in the root for this but I have everything uploaded to /myspace folder.

Do I have to manually change everything so it’s…

<img src="/myspace/img/friendspace.gif"

or can I get around that to somehow get it to automatically go to the /myspace folder ?

Try taking the / out from in front of myspace. Some times the browser might add an extra one for example:

“img/foo.jpg” should do then.

If it was in the root directory. I have everything uploaded to /myspace folder.

Is there a way to get the root_dir to = /myspace ?

If the script is in the dir that the folder img is in, just use img/whatever.gif otherwise if you have the script in a folder in a dir that has img folder in it you would have …/img/whatever.gif and so on.

Thanks OpzMaster it was the / I had to remove from the img paths and some link paths. I also had to add a period . in certain instances such as ./css/css.css and ./js/source.js

I still have to go through a bunch of files (seems like several hundred files) and complete the process but I’m so glad I got it resolved. I can’t believe it was something so simple.

Thanks again to you both for taking the time to help me out.


Remember, the ones that drive you crazy are the ones that are so very simple. Glad to have solved your problem. :D

[php]$mysql_server = DB_SERVER;
$mysql_user = DB_USER;
$mysql_pass = DB_PASSWORD;
$mysql_db = DB_DATABASE;

$strDBServer = $mysql_server;
$strDBUser = $mysql_user;
$strDBPass = $mysql_pass;
$strDBName = $mysql_db;[/php]

Just wondering why you don’t combine these? Just wondering.

Sponsor our Newsletter | Privacy Policy | Terms of Service