Serious help needed

Hi guys I am in need of some serious help, I have asked everywhere and no one can find the answer to my problem yet.

I am fairly new to php and would really appreciate it if anyone can help.

Basically I recently bought some script that goes with my website I wanted and in there was a custompage.php file where I can have my pages looking the same as all the rest but with my own content that I code in. The coding looks like this:

[php]<?
include("./includes/egl_inc.php");

$out[body].="

Custom Page
This is a custom page. You may add anything you want here.




";

include("$config");

?>[/php]

The problem I have and that no one can seem to solve is that when I go up a level from the root folder for e.g. I wanted to create a new file and have pages in there to keep things better organised.

Now when i add the extra . to the include("./includes/egl_inc.php"); part of the coding all is well but the error I am constantly getting is from the

[php]include("$config");[/php]

If dreamweaver or I change the directory …/ ./ in any way it doesnt work if i leave it as it is it doesnt work I have tried everything others mentioned doing the [php]Include "{$_SERVER[‘DOCUMENT_ROOT’]}[/php] which again works fine on the egl_inc page but not the $config section.

What winds me up is that the people who did the script can’t seem to work out the issue and are offering me other ways around it for more money and they have already had a fortune off me.

There is a config.php file on my root folder however this just seems to be config of my server that it is set up on.

I think this $config section shows all of how the page should display so there is a folder /theme/neo-green/html.php

In that folder seems to be all the html code of how my page looks and i am assuming that somehow this $config is pulling that out and into the files. As i say works fine on the root folder but if i try have files any where else in other folders no way will it have it and i get the following error message when i view webpage

Warning: main(./config.php) [function.main]: failed to open stream: No such file or directory in /websites/123reg/LinuxPackage23/lf/sf/lo/lfsfloorings.co.uk/public_html/DOA360/includes/globals.php on line 0

looks to me like a path problem - a relative path problem to be precise.
The advice you received about using $_SERVER[‘DOCUMENT_ROOT’] should have also said you need to include the rest of the path to the file.
For example: You have a folder inside public_html called abc.
Then, to get to files inside that dir you would use:
[php]$_SERVER[‘DOCUMENT_ROOT’] . ‘/abc/filenamehere.php’[/php]

Make sense?

Cool, now you understand that, I visited your website and noted that globals.php is three levels deep so to access it you would need:
[php]$_SERVER[‘DOCUMENT_ROOT’] . ‘/DOA360/includes/globals.php’[/php]

Let me know how you get on.
Red :wink:

Hi Red,

Thanks for your reply if you can sort this problem I will buy you a coffee for sure :wink:

It is driving me bonkers been at it weeks

I was advised to put the rest of the path afterwards, My file currently looks like this:

[php]include “{$_SERVER[‘DOCUMENT_ROOT’]}/includes/egl_inc.php”;

$out[body].="

Custom Page
This is a custom page. You may add anything you want here.




";

include ("$config");

?>[/php]

As you can see on line 2 i am using the server / document root path coding but it is this bottom line with the

[php]include ("$config");
[/php]

That is the issue i have asked the programmers what it refers to and he says he thinks it makes the pages look how they look. So i am assuming it comes from ./theme/neo-green/html.php as this file holds all the coding of how my frontpage looks and the rest of the site with the boxes, menu etc and am i right in assuming that the ‘html’ part of that coding is saying to just pull the html side of things out of it or am i way off the mark there.

The thing that really gets to me is the guys that built it can’t find why this doesn’t work but i tried replacing and adding what you said with the globals.php and that didn’t work either.

but i don’t see why i get that error message to do with globals.php as i wasnt aware that was coming into play and that line 0 existed so hopefully you can see why this is driving me mad, the laptop is ever closer to going through a window lol.

Hope i explain this well enough as i am running out of ways to say things lol and as i say php is all new to me at the moment

Thanks again, really appreciate your response

reading your code i can see $config holds some css information like colours etc. What i can’t see is where $config is set? I am assuming it is in this file ‘egl_inc.php’ (or another that is included in that file.)

Secondly, If, as i assume, it is holding css data, then this include($config) doesn’t make sense??
If you wish, zip up the relevant files and email them to me so I can have a good read through and get back to you.

(or you can post them here if you wish starting with this file: egl_inc.php )

Red :wink:

PS: You should remove any sensitive data like usernames/passwords before posting/sending them. :wink:

Hi Red,

I have sent over a few files to the email on your profile

Thanks again :smiley:

can you post/send the entire page of the script you posted below…

Do you mean the page that i am trying to get to work in a different folder

Sent the file that I have been working on, hope that was the one you want

Hello mate, sorry for delay, something serious came to my attention with one of my websites that I had to jump on straight away! (still not finished :frowning: )…

In the last file you sent me the first and last lines contradict each other.
1st line:
[php]include “{$_SERVER[‘DOCUMENT_ROOT’]}/includes/egl_inc.php”;[/php]
last line:
[php]$_SERVER[‘DOCUMENT_ROOT’] . ‘/DOA360/includes/globals.php’[/php]

I’m guessing here, but i think you added the last line, if that’s the case, drop the DOA360 from the path and try that as the first line suggests the includes dir is not inside that folder.

Let me know how ya get on.
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service