Best relative links &cet for offline PHP previewing?

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
krystof
-


Joined: 26 Feb 2007
Posts: 3
Location: New England

PostPosted: Mon Feb 26, 2007 1:41 pm    Post subject: Best relative links &cet for offline PHP previewing? Reply with quote

Hello everybody!

I am a Newby...both to this forum and to web servers...

Here is my situation:

My friends and I need to edit web pages from places in Asia where it is impossible to find a workable internet connection.

Also, I just want to do-it-myself a few basic ecommerce sites...I don't want to be a programmer, webdesigner or webhost...so I don't want to learn PHP and don't need to but...I am a strong believer in PHP "server-side" includes...which are best edited with a server to show the results.

I was delighted to stumble on the free-and-easy Abyss desktop server.

Yes, my Abyss-X1 with PHP5 is running with no problem! Hurrah! I can see my PHP pages without the internet! I can even carry server-and-sites around, all in one tiny flash drive! And I would be happy to pay $20 for Abyss-X2. But US$60 is rather steep for a fancy web server that will not be serving the web...


MY PROBLEMS:

I have several websites. With Abyss-X1 (only one host allowed) I must put all sites inside subfolders, within a single root folder such as "htdocs." This complicates the "relative paths" needed for efficient "includes."

I may be fuzzy about "relative paths" but here are my trial-and-error assumptions:

a) Start-at-root method: a relative path starting with a plain slash ("/") means "start at the root or home page level." I like this, because I can use the same path from any level of a multi-level site. It works with SSI and IMG. But not with PHP includes. (At least not with my current host.)

Also, start-at-root normally will not work when viewing "offline" through Abyss-X1 on my desktop, because each "home page" can no longer be in the "root" level of the "htdocs" folder, a.k.a. http://localhost. Instead, with X1 and several sites, each site's home page must be inside a subfolder such as http://localhost/subfolder-x

"If" the start-at-root method is supposed to work for PHP include calls, then it is ideal for the uploaded "final versions" of the websites. This is also workable (but a nuisance) for offline previewing as "localhost" with Abyss-X1, if I go to:

console > default host > configure > server root

...and manually change this, each time I work on a different website.

b) Start-at-file method: a relative path starting with dot-dot-slash ("../") means "starting where you are, go up one level." This can be repeated to "go up two levels" etc. But (at least with my last webhost) with PHP includes, this means that if you "include" the same navigation menu from level 2, its links will end up differently than if you "include" it from level 3.


MY QUESTIONS:

--Is the "start-at-root" method ("/") supposed to work with PHP includes? I.e., do I simply need to find a different webhost with the proper configurations?

--Can the "start-at-root" method be made to work when viewing pages offline as:

http://localhost/subfolder

...without repeatedly re-configuring the server root? ?

--Again for offline viewing: can http://localhost/knf (my subfolder for kwik-n-free.com) be replaced with something shorter, like http://kwik-n-free.com or http://knf ?

I.e., can Abyss be made to recognize something equivalent to a "local nameserver" when it is offline? (Not vital, but it would be nice.)

--If I must use the "start-at-file" method ("../") then do I have to make a different set of PHP include files for each level, because they end up "relatively" different for each level, even though they are "supposed" to result in the same navigation menu?


Link references.

A few of these pages are off-topic, but I learned some useful tips from all of them. (Mostly found by a forum search for "relative.") Some of the discussions "almost" seemed to answer some of my primary questions. However, the discussion sometimes went above my head, or seemed outdated. Also primarily, most discussions seemed focused on operating Abyss as an online web server, not as an offline PHP previewer.

AbyssUnderground.co.uk
Abyss Tutorials Forum
Relative Abyss (2007)
How to get PHP to use relative filenames... (2007)
Installing Abyss Web Server on an External USB Hard Drive (2007)
Short URL's (2006)
Direct Path Question (2006)
PHP Includes (2006)
USB Webserver ... (2006)
abyss portable? (2006)
6 Tips To Secure Your Website (2006)
Hosting mutiples sites need input (2006)
Running Multiple Sites / Domains On Abyss (2004)
host 2 different websites (2004)
port 80 is already in use (2004)


Can anyone help to clarify the above questions, please?

Thank you for your replies, anyone!
_________________
krystof
Back to top View user's profile Send private message Visit poster's website
Flux
-


Joined: 13 Oct 2006
Posts: 48

PostPosted: Mon Feb 26, 2007 4:34 pm    Post subject: Reply with quote

Quote:
--Is the "start-at-root" method ("/") supposed to work with PHP includes? I.e., do I simply need to find a different webhost with the proper configurations?

You mean:
Code:
<?php include 'file.php'; ?>

Right? It goes straight to the home directory from anywhere if you say:
Code:
<?php include '/file.php'; ?>

And I don't think it would matter what server you use because the PHP interpreter (from http://php.net) is (I think) quite universal.
Quote:
--Can the "start-at-root" method be made to work when viewing pages offline as:

http://localhost/subfolder

...without repeatedly re-configuring the server root? ?

If that exists in Abyss Webserver X1 then it's well hidden. But I just copy the entire program folder and paste, then use the folder copy to open another instance :P (Only so I can separate my webserver from the server that contains phpMyAdmin for MySQL)
Quote:
--Again for offline viewing: can http://localhost/knf (my subfolder for kwik-n-free.com) be replaced with something shorter, like http://kwik-n-free.com or http://knf ?

I don't think X1 can do nameserver stuff either. But you can configure your network settings (although you'd have to change it each time) so that your computer's network name is "knf" or "kwik-n-free.com" (e.g. my computer's network name is "epsilon" [cheesy I know] so i can navigate to its website from anywhere on my network by using http://epsilon/
Quote:
--If I must use the "start-at-file" method ("../") then do I have to make a different set of PHP include files for each level, because they end up "relatively" different for each level, even though they are "supposed" to result in the same navigation menu?

See the first response.

Sorry if I totally don't get what you're saying, but these are my answers.
_________________
My signature is so lame.

I think phpBB forums hates my laptop '.';
Back to top View user's profile Send private message
krystof
-


Joined: 26 Feb 2007
Posts: 3
Location: New England

PostPosted: Tue Feb 27, 2007 3:33 am    Post subject: Reply with quote

:) Thank you very much FLUX!

Yes, it sounds like you already do the same things I am trying to do!

So:

--I will re-do my home page for every relative reference to "start at root" like you said:
<?php include '/file.inc'; ?>

...so evidently this "should" work on Aprelium and if so, "should" work on any webhost (or else I should complain that maybe he has some weird settings).

...however...it has been awhile since I edited any webpages...but when I switched from SSI includes to PHP includes, I just now seem to remember a "relativity problem" that appeared with PHP. No matter which relative linking method used: when a navigation menu was "included" to the third level, the result was different than when "included" to the second level. Similar to the problem I described with the "start-at-file" method ("../").

(If anyone knows anything about this, your comments will be appreciated. Otherwise, I better just test everything again and see what happens.)

Flux wrote:
...I just copy the entire program folder and paste, then use the folder copy to open another instance :P (Only so I can separate my webserver from the server that contains phpMyAdmin for MySQL)...I don't think X1 can do nameserver stuff either. But you can configure your network settings (although you'd have to change it each time) so that your computer's network name is "knf" or "kwik-n-free.com"

Yes again, this certainly makes things clearer!

--Currently, I don't understand anything about "phpMyAdmin for MySQL"...but I have a feeling I will find this useful someday...

--"Renaming the network" doesn't seem worth the trouble if it has to be re-done...though it might be nice to call my computer "Amy"...and this also might shorten the "localhost" URL (?)...but I need to travel somewhat, so I like to maintain the habit of keeping everything on flash drives and moving between computers.

So basically, from what you describe, FLUX, it seems that to "configure the server root" (as I guessed above), every time I edit a different site, is just as easy as any option. If I did it your way (repeatedly move or copy entire folders): I am not quite clear what you mean, but in any case, am afraid I might get confused and cause file degradation to images or something. So, I think I had better stick with "configure the server root."

By the way, maybe all this seems a bit nonessential. However, when maintaining several wesites, I certainly can get bored from staring at the same one too long. I do think it would be nicer to preview a different website with a single click...

Well, I guess that just can't be done with X1.

(I am going to take a look at the X2 user license. Maybe I can use it at reduced cost because it is technically non-active...? If not, maybe I will look for another "free" desktop server. I really like Abyss and would certainly prefer not to.)
_________________
krystof
Back to top View user's profile Send private message Visit poster's website
Flux
-


Joined: 13 Oct 2006
Posts: 48

PostPosted: Tue Feb 27, 2007 4:21 am    Post subject: Reply with quote

Just a little note:

phpMyAdmin is a php-encoded, webpage-based administration console for the database server known as MySQL.

I'm hoping you know that databases are for storing information, such as usernames and passwords (so if you have a site involving users, and you want/need to make the whole process of becoming and using the advantages of being a member automatic, then SQL server databases are the way to go). MySQL is a brand of SQL database (SQL simply indicating the language used to "talk" to it) that happens to be the most popular free one on the web.

phpMyAdmin just makes "talking" to it more user/newbie encoder(such as myself [or so I think])-friendly

anyway everything I learned in encoding is based off of tutorials and "stolen" (i.e. taken from a source that freely and consciously gives it) source code, so I don't think it too hard to learn php as you need it.
_________________
My signature is so lame.

I think phpBB forums hates my laptop '.';
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group