Part of the EllisLab Network
pMachine Pro has been replaced by ExpressionEngine, our full featured web publishing solution. Please consider upgrading.
You can download pMachine Pro here: Download pMachine Pro  |  Download Language Packs
   
 
Still Troubled with urls from different folders
Posted: 24 April 2005 01:32 PM   [ Ignore ]  
Summer Student
Total Posts:  4
Joined  2004-01-20

THanks for the earlier reply to my post on getting the SSI to work when called from sub folders. Apparently usintg the full path to the include file corrected the situation.
BUT Im still at a loss to understand what is going on. for instance when I am 2 folders deep if I call the include file with a static address like this

<?php
require(“http://localhost/pmachine/framework/Menu.php”);
?>

I get an error in the menu.php file where i am using the PMachine template:

<?php member_login_navbar(); ?>

But if I call the menu.php like this:

<?php
require(’../framework/Menu.php’);
?>

I get no error??

It also confuses me that i can access my CSS files that live in a subfolder of the root dir without absolute addressing but not my includes. Can any one shed some light into what I am missing?  I also have been unable to lod\cate any variables used in the templates such as paths. where are the variables stored?

Profile
 
 
Posted: 24 April 2005 01:58 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  2002-06-19

> require(“http://localhost/pmachine/framework/Menu.php”);

That is not a full server path as I indicated in the previous reply; that’s the full URL.  They’re two different things.  As I mentioned earlier, if you don’t know what the full server path is for your server/account, then contact your Host or server admin.  The “full server path” and “full URL” are not interchangeable when it comes to things in PHP; it’s important that you use the correct one.

The reason you probably got an error when you used the above URL method is that doing so causes PHP to parse/process the file before it then includes the contents in the parent file.  Using the full server path as I indicated should not cause the server to parse the files first; instead it will simply be included inline and then parsed with the rest of the file, which means that the required calls to the pMachine backend files will be present.


I don’t understand what you’re asking in the last paragraph.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 24 April 2005 02:14 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  4
Joined  2004-01-20

Sorry for the confusion.
It seems that i am confusing absolute and relative addressing. first of all let me say that I am the server admin. Currently this is running on my local server. 127.0.0.1 it is in side the path c:\program files\apache\htdocs\pmachine. Pmachine being the site I am working with. there are other sites residing in the htdocs folder also.

secondly let me try to ask this way.
When programming in VB i can use the command “App.Path” to tell vb to go to the location my application is running and from the follow the reset of my path to the requested file like this:

fileName = app.path & “Subfolder1\subfolder2\filename.txt”

Im trying to do similar (if possible) here. The goal is to keep a folder hierarchy that is compartmentalized. Is this the wrong approach? Should I just dump all my files in one folder? I am guessing to do so would cause difficulties down the road as the site grows.

Profile
 
 
Posted: 24 April 2005 06:04 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  2002-06-19

Paths
There are really 4 types of paths you might deal with:

1. Full (absolute) URLs: http://www.example.com/images/pic.jpg

2. Relative URLs: ../images/pic.jpg

3. Absolute server paths: /home/domain.com/public_html/images/pic.jpg (or c:\program files\apache\htdocs\images\pic.jpg )

4. Relative server paths: ../images/pic.jpg

In practice, 2 & 4 usually amount to the same thing when using them, but they are different things behind the scenes.


> When programming in VB i can use the command “App.Path” to tell vb to go to the location my application is running

You could probably try using the “DOCUMENT_ROOT” environmental variable.  Try something like:

<?php include($_SERVER['DOCUMENT_ROOT'] . "pmachine/framework/Menu.php"); ?>

You may need to experiment a little and determine exactly what path is getting output by the variable to know exactly how to construct the call.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 25 April 2005 10:01 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  4
Joined  2004-01-20

You could probably try using the “DOCUMENT_ROOT” environmental variable. Try something like:


<?php include($_SERVER[‘DOCUMENT_ROOT’] . “pmachine/framework/Menu.php”); ?>

That worked great! Exactly what I was looking for. Been burning out reading the php documentation trying to get up to par on syntax. It is annoying to know what you need to do but not know the language. Like being in a foriegn country.

Thanks for your help

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 233, on December 18, 2007 12:04 AM
Total Registered Members: 64508 Total Logged-in Users: 0
Total Topics: 81067 Total Anonymous Users: 0
Total Replies: 436294 Total Guests: 22
Total Posts: 517361    
Members ( View Memberlist )
Active Members: