Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 31st, 2005, 2:53 AM   #1
scorpiosage
Programmer
 
scorpiosage's Avatar
 
Join Date: Aug 2004
Location: Austin, Tx
Posts: 55
Rep Power: 5 scorpiosage is on a distinguished road
Send a message via AIM to scorpiosage Send a message via Yahoo to scorpiosage
PHP Includes?

Well, I am using include statements on one of my projects. I am kind of racking my brain about something.

First off, the server I am using, I have no access to PHP.ini. I have set up under my root directory, a directory called includes, and there is where I am storing my include file called include.php.

A few notes, I have seen things like include.inc or include.inc.php and so on and so forth. I am sure that you can make the file extention basically anything, .txt if you wish as well, as it is once the information is sent to the browser, it is then parsed on the server side and resent to the browser. So all you are saying is, take this and use it.

anyway, the extention is unimportant to my question, sorry, but was sort of a fun theory to write.

The question: when I am using my includes I am writting
 
<? include 'include/include.php';
echo $whatever;
?>
this works fine right?
Now, let's say, my document that I want to call it from is in another directory.
The code would have to look like this.
 
<? include '../include/include.php';
echo $whatever;
?>
wich works.
Is there a way that I can construct my includes so that I can call them with one string from anywhere on the website. hardcoding them with the exact URL does not seem to work at all.

Thoughts?
Thanks
Mike
__________________
Here's my latest project still in the works, and I need to get rid of this &quot;frame&quot; situation for real. www.prideofaustin.com
scorpiosage is offline   Reply With Quote
Old Jan 31st, 2005, 10:24 AM   #2
Dizzutch
Professional Programmer
 
Dizzutch's Avatar
 
Join Date: Dec 2004
Location: Worcester, MA
Posts: 441
Rep Power: 4 Dizzutch is on a distinguished road
Send a message via ICQ to Dizzutch Send a message via AIM to Dizzutch Send a message via MSN to Dizzutch Send a message via Yahoo to Dizzutch
if you just call them from /includes/... the / brings you to the root of your directory tree, which in the server should be chrooted. so in both cases using [php]<?php include("/include/include.php"); echo $whatever; ?>[/php] will use the correct include file.
__________________
naked pictures of you | PFO F@H stats
Dizzutch is offline   Reply With Quote
Old Jan 31st, 2005, 10:56 AM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Or if you have shell access you could link them to one include dir and call from there like you were before. That's if your running linux.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Feb 1st, 2005, 2:54 AM   #4
scorpiosage
Programmer
 
scorpiosage's Avatar
 
Join Date: Aug 2004
Location: Austin, Tx
Posts: 55
Rep Power: 5 scorpiosage is on a distinguished road
Send a message via AIM to scorpiosage Send a message via Yahoo to scorpiosage
Thanks guys,
That pretty much confirmed my what I thought on this matter.
The hosting I am using has not shell SSH access, they claim ummm.. security issues.
I thought that was the reason we got away from telnet and into SSH to begin with, but then again, I just might be the fool on that one..LOL.

Thanks again for the replies.
Mike
__________________
Here's my latest project still in the works, and I need to get rid of this &quot;frame&quot; situation for real. www.prideofaustin.com
scorpiosage is offline   Reply With Quote
Old Feb 1st, 2005, 4:34 AM   #5
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
Run this script from the same directory that the first script is in...

echo `pwd` . "/include/include.php";

You should be able to use what it prints out as your include statement's argument. This will be universal
__________________

tempest is offline   Reply With Quote
Old Feb 4th, 2005, 2:46 AM   #6
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
softlink directories... that always works too.. very effective I might add.
__________________
Clifford Matthew Roche &lt;geek@cliffordroche.com&gt;
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC