Need help with 2 things

The first one is easy and I know im going to kick myself once i find it. Basicly im using the require (“header”);. This file is located in the root of my webpage. So if im about 3 folders in “/fd1/fd2/fd3.index.php” other then adding in the “…/…/” infront. Any ideas…

Second is im trying to add a scroll bar in a menu. I tried the frames function but wth my file structure it doesnt work to well.
I have a header, footer and a menu. Then the main page. Now i dont care if hte header and footer move but the frames i want to stay still along with having a scroll bar. Any ideas.

Thanks for the help

Your first question:
Use absolute naming. Ie: “include '/filename.inc”;’ instead of ‘include “…/…/…/filename.inc”’.

Second question:
A bit hard to understand what you mean, but it sounds to me like what you ought to get is an iframe:

Have you tried puting your menu in a

. I had a problem like this one for the new version of my site (wich is not online at this moment) and i used the next coding to do it

[code]

[/code]

Output the “” in the coding and the height must be a fixed value greater than the menu itself. I hope this will solve your problem or at least, part of it.

Friendly, Lucifer Christ

This is what i tried

<?php include ('/header.inc'); ?>

Got errors… Couldnt find header.inc in /apps/
reason being is in my / dir. So i would have to place the …/ in order for it to work. Any other ideas or am i doing something wrong?

The absolute naming should not go to a non-root folder. When you link to “/filename” it should link to your root folder, file “filename”.

Why is your server looking for the root folder in /apps ?

this is a real basic Win2k machine using IIS. Do you know of a setting i should be looking for?

Not a clue, mate. I’ve never seen it do that.

did you try require("/f1/f2/f3/index.php")? What’s you actual, absolute location? If file is c:/bob/mary/lance/index.php then if you are in root, require is “index.php” or “/bob/mary/lance/index.php”.

Look into iframes - inline frames. I use them with header/footers and they will display an external page with scroll bars as needed to a specific height and width.

I don’t know what webserver you (or he, for that matter) use, but with apache, the absolute root is the wwwroot. So if I link to /index.php it will go to wherever my wwwroot is (say, C:/inetpub/wwwroot by default in Windows with IIS) and get index.php. To access anything outside the wwwroot would require accessing it via the filesystem utilities, such as fopen, not just including files.

Point being, I don’t see why where his wwwroot is makes a difference. Linking to “/something” links to the wwwroot/something - no matter where the wwwroot is.

I use both Apache and IIS at home and work and I’ve never had Apache resolve root to %webroot%. All of my Apache scripts need /websites/yada/htdocs/ (or whatever structure is used) to be included. This is not an Apache setting, it’s a php.ini setting. Since I host multiple sites, maybe my config is different, but since it’s possible to have many sites located on one server with only one install of PHP, it makes no sense to lock php’s root into your web root, and that isn’t the default. Easy answer - is to test:

I’m on a file 2 deep from %webroot%. These work:

include "/websites/intranet/htdocs/system/config.php";
include "../../system/config.php";

This does not:

[code]
include “/system/config.php”;

Warning: main(/system/config.php): failed to open stream: No such file or directory in C:Websitesintranethtdocsadmintticketsedit.php [/code]
So at least for my settings, which are pretty much barely tweaked defaults as far as directories, your path is from the root of the drive, not %webroot%.

You CAN make a function that looks at the current file, reads the path and figures out the full path to root, but I just use relative paths and everything seems to work fine.

<?php include "/index.php"; ?>

Hello World

Weird…

There’s got to be something going on in the ini’s. I can’t imagine it would be httpd.conf, do you? I seriously have never had an install use webroot, and I’m talking around 10 different servers spread across 2-3 years. Or it could be one of those things that’s so obvious I’m looking right over it.

I’ve not a clue, TBH with you. I’ve always just accepted that this was default, and until now I’d not seen any reason to think otherwise.

Sponsor our Newsletter | Privacy Policy | Terms of Service