PCTechTalkhttp://www.pctechtalk.com/forums/

Go Back   PCTechTalk > PC Tech > Web Related

Reply
 
LinkBack Thread Tools Display Modes
Old 06-09-2004, 03:04 PM   #1 (permalink)
Registered User
 
Colin-uk's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 928
Colin-uk is on a distinguished road
(php) links in echoed pages..?

ok say my directory structure is like this..

/public_html/
index.html

/public_html/css/
index.php
files.php

/public_html/css/data/
page1.html
page2.html

page1.html has a link to files.php
(../files.php)

if i put the following code in /public_html/css/index.php will the links point to /public_html/css/files.php or will it point to /public_html/files.php (which doesnt exist) ?

Code:
<?php

$data = file_get_contents('page1.html');
echo "$data";

?>
hope i explained that ok...

Thanks
Colin
Colin-uk is offline   Reply With Quote
Old 06-10-2004, 06:12 AM   #2 (permalink)
Registered User
 
JamesT's Avatar
 
Join Date: Oct 2003
Location: United Kingdom
Posts: 186
JamesT is on a distinguished road
It will point to /public_html/css/files.php.

../ Goes back one directory. and ./ is the the current directory.

What i would to save complication in the future is define a variable, say called $dir_root which would containt the full root to your base directory. EG

$dir_root = 'http://www.yourwebsitename.com';

You can put this in a file called config.php and call it from every page or you just define that variable on every page.

So you would link like this to the files.php in the css folder.

<a href="<? echo "$dir_root"; ?>/css/files.php">

Hope you understand, because when i read it back to myself, didnt make sense :0
__________________
RIG 1
AMD Athlon XP3000+
PC Chips M848ALU
Crucial DDR 512MB PC2700
160GB Seagate HD
ATI Radeon 9600 Atlantis 128MB
JamesT is offline   Reply With Quote
Old 06-10-2004, 09:44 AM   #3 (permalink)
Registered User
 
Colin-uk's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 928
Colin-uk is on a distinguished road
Thanks James, much appreciated and thats a cool idea, might do that in the future
Colin-uk is offline   Reply With Quote
Old 06-12-2004, 05:58 AM   #4 (permalink)
Registered User
 
JamesT's Avatar
 
Join Date: Oct 2003
Location: United Kingdom
Posts: 186
JamesT is on a distinguished road
No Problemo
__________________
RIG 1
AMD Athlon XP3000+
PC Chips M848ALU
Crucial DDR 512MB PC2700
160GB Seagate HD
ATI Radeon 9600 Atlantis 128MB
JamesT is offline   Reply With Quote
Old 06-12-2004, 06:03 AM   #5 (permalink)
Da House Nerd
 
greffov's Avatar
 
Join Date: Dec 1969
Location: One CPU Lane
Posts: 3,512
greffov will become famous soon enough
one thing that comes to my mind:

Why? (would one want to do such thing?!?!?!?)
__________________
Linux virusscanner detected a virus:
Windows 95 ... delete [Y/n] y
~
~

:wq
greffov is offline   Reply With Quote
Old 06-12-2004, 03:04 PM   #6 (permalink)
Registered User
 
Colin-uk's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 928
Colin-uk is on a distinguished road
Well i have a script that out puts a message based on whether the script failed or was successfull or not...

i could just echo the words "success" and "failed" but that just one word on a blank white page, doesnt really look v good, so i keep my page layout in a text file and echo that instead
Colin-uk is offline   Reply With Quote
Reply

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 06:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
2001 PCTechTalk