Jump to content

Recommended Posts

Hi guys i am in need of some serious help with some coding that i am having trouble with, it is to do with trying to get a page to appear correct when it is one level or more up from the main root folder and for some reason it just doesn't seem to apply to normal coding...

 

Below is the standard custompage that is created to add new pages and the coding represents a file that is located on the main folder:

<?

include("./includes/egl_inc.php");

$out[body].="
<br>
<center>
<table width='90%' border='0' cellspacing='1' cellpadding='2' bgcolor='#000000'>
<tr bgcolor='$config[altcolora]'>
<td width='100%' background='$config[bg]' valign='center' align='center' colspan='5'><b>Custom Page</b></td>
</tr>
<tr bgcolor='$config[altcolorb]'>
<td width='100%'valign='center' align='center' colspan='5'>This is a custom page. You may add anything you want here.</td>
</tr>
</table></center><br /><br /><br /><br />";

include("$config[html]");

?>

Below is the same file that i have saved in dreamweaver as one level up in a folder from the main root folder of the website, dreamweaver as you will already know kindly updates the links for you, howvever as you can see with the ../ fixture to go up a level i have tried these with ./ ../../ many different way i can think of and it just doesnt happen.

<?

include("../includes/egl_inc.php");

$out[body].="
<br>
<center>
<table width='90%' border='0' cellspacing='1' cellpadding='2' bgcolor='#000000'>
<tr bgcolor='$config[altcolora]'>
<td width='100%' background='$config[bg]' valign='center' align='center' colspan='5'><b>Custom Page</b></td>
</tr>
<tr bgcolor='$config[altcolorb]'>
<td width='100%'valign='center' align='center' colspan='5'>This is a custom page. You may add anything you want here.</td>
</tr>
</table></center><br /><br /><br /><br />";

include("../$config[html]");

?>

I think that the problem lies with the config file at the end of the coding because when i have changed things around, don't ask which bit as i have done that much on it, that is the only error i get nothing about the above.

 

The error messgae i am getting when i visit this page on the net is:

 

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

 

which again drives me crazy since there is no line 0

 

please help afte 3 weeks this is driving me insane.

 

Thanks in advance to anyone willing to help

Link to comment
https://forums.phpfreaks.com/topic/282939-serious-help-needed-please/
Share on other sites

The file you are trying to display, have u echoed getcwd() in there to ensure that your file paths are correct?

 

I'm not sure which of the two files you are trying to display correctly, and what the file name is in the code. Try to getcwd of the file and see if they match up.

Instead of using document-relative paths, have you considered root-relative? For example, you could do something like the following:

<?php
include "{$_SERVER['DOCUMENT_ROOT']}/includes/egl_inc.php";
?>

With this, you won't need to change the include code from page to page.

  • 4 weeks later...

$_SERVER['DOCUMENT_ROOT'] should already hold the information regarding your root folder. You should only need to modify what comes after the closing curly bracket. More information about the $_SERVER variable can be found here:

http://php.net/manual/en/reserved.variables.server.php

Hi there thanks again I seem to have got this working using the above coding but again only on files that are at the root, The problem seems to lie with the below coding

include("$config[html]");

this I think is referring to the config.php file found on the root which is just basically containing the information and configuration of my server, what I find baffling is that it is a php file and they have in the brackets html.

 

So when ever I have files inside another folder this just doesn't work so is there a way i can put this coding in with the coding you suggested.

 

What really frustrates me is the guys behind the software are doing bugger all to help and say they can't fatham it out after buying the damn thing it is driving me crazy all i want is to be able to have files in other folders to keep things neat and can't get it done.

 

Thanks again CyberRobot for your help and patients I really appreciate it.

Ok with that coding when I edit a file that is up one level from the root folder I get this when I visit the page on the website

./theme/neo-green/html.php

This file above is the theme i use and alot of the rules and page content is in here

 

However if i go up 3-4 levels which I need I get this message that i have had previously on when trying to go up the levels which looks like this

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

Thanks again

Just to clarify, $config['html'] contains "./theme/neo-green/html.php"? If so, could you clarify where $config comes from? If this comes from a third-party solution, maybe there is some documentation online. There may be something else in $config, for example, that could be used to get a root-relative link. You could even try adding the following and see if it displays everything in the variable:

 

 

<?php
echo '<pre>' . print_r($config, true) . '</pre>';
?>

This is what i am unclear with as the only config file i can find is in the route folder but it is a config.php file that just includes all my database details of where the script is installed.

 

I will have a chat with the guys that built it again and try get some insight into what that file does exactly because there is more than meets the eye with this.

No at first I thought it would because it doesn't seem to be a directory and doesn't act like one but yet it works for as long as you are making a file on the root folder.

 

Basically when I bought the script for the website they added  a page on the root folder called custompage.php this is a page that appears like all the others on the website but with my custom content in a section that I put there.

 

So to make things easy to manage I wanted to put some pages inside files on the root folder and I have this same problem it is driving me round the bend spent a fortune on this and to be honest quite a few bits of things I have had to fix my self as wasn't running smoothly.

 

Sometimes the staff are really good and fix things but other times seems they have no clue.

 

I recently contacted them about this issue and tried to find out what the 

$config['html']

referred to so we can try and fix the issue, just told them I had a friend looking into it.

 

This is the reply I got:

 

Yeah, I couldn't work out any other way of achieving your aims without making it far more basic. Obviously, you could easily put each file on the root, as you know a simple file works there, but it would end up being complicated to manage. Just thought of another idea. In fact, I think I alluded to it before. The best way around this, for every reason, is to use Mysql and place all content in the actual database and not a file. For example, you could make a new table called 'articles' and create a small script with folder heirachy. basically, a mini-cms script. This is something on our development path but not for a year. I could almost do it myself, and the way I would do it would be to copy the code from the 'rules' part of the script and bastardize it to match the needs. i.e. you go into the admin panel and you have a duplicate section in there but instead of creating rules you create a page with a unique ID, give it a title and a description, which turns out to be the content of the page. The script would recreate the title on a MAIN page, with a link to the new page. The complicated bit is the Folder system. In the 'Article' section you would first need to create your Folder names (basicaly categories) into which you place this content. Now, I think its a dozen or so hours of work, probably costing quite a bit but I would be willing to subsidize it on the basis that we retain ownership rights and are able to sell it on to recoup our costs. I reckon we could sell it for $15 a time and maybe sell a dozen so it would be a bit tight... What is the most you would be willing to contribute towards it and i will get quote from a programmer and see if we can absorb it. Regards Jake Allen Head of Support

 

So basically he want to do it another way he knows how and charge me for something else, I don't want this I want the way it is now to bloody work or at least a straight answer as to how the $config

 thing works.

 

So I have replied asking them again how it works and declining to pay any more. Think I have been done over here and may have to accept defeat.

I tried the above code in the $config place and the page displayed the same if that's what you mean.

 

I have got a little closer with this whole thing though in my root folder /theme/neo-green which obviously contains the theme / template that my site uses there is a html.php file

 

Now by the looks of things this is what is the pages appearance as every page you look at online conatains the coding from this file somewhere, I also spot at the very top of the page on line 1 is this 

<?php
translate("./theme/neo-green/language/" . $config[language] . ".php");
?>

Also further down the document it has coding to include the header, footer, frontpage etc so it has got to be a way of how they are adding certain things from that page.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.