Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8632

Re: Include file in localhost

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Include file in localhost
Date 2013-03-11 09:56 +0100
Message-ID <aq5khqF62rdU1@mid.uni-berlin.de> (permalink)
References <083528a4-0753-40f7-9f74-74056bf0c019@googlegroups.com>

Show all headers | View raw


Am 10.03.2013 03:16, schrieb huynhtoan.it@gmail.com:
> My project(Mysite) have some folder and file as
> .folderA
>   + a.php
>   + b.php
> .folderB
>   + c.php
> .folderC
>     .folder D
>       + d.php
> index.php
> ................
> when I want to include file a.php in index.php, I have code
> include("folderA/a.php")->I know
> 
> when I want to include file a.php in d.php and link to index.php, my code must like
> include(../../folderA/a.php)
> <a href="../../index.php">ex</a>-> It's ok.
> 
> But when I have include file d.php in c.php, I have an error:
> a href link to another directory in my warm because a href is ../../index.php
> I try to a href("/Mysite/index.php") But my address in google Chrome is http://localhost/Mysite/folderC/folderD/localhost/Mysite/index.php -> it's wrong
> Can You give me a method to correct it??
>  

After the technical details are answered, you should ask yourself if your folder
structure makes sense.

It looks like a mess. You would normally avoid to include from here and there across
the directory tree.

And then see the differences between include(), require(), require_once().

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Include file in localhost huynhtoan.it@gmail.com - 2013-03-09 18:16 -0800
  Re: Include file in localhost Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-09 23:05 -0500
  Re: Include file in localhost Denis McMahon <denismfmcmahon@gmail.com> - 2013-03-10 04:09 +0000
  Re: Include file in localhost The Natural Philosopher <tnp@invalid.invalid> - 2013-03-10 11:40 +0000
  Re: Include file in localhost "J.O. Aho" <user@example.net> - 2013-03-10 15:15 +0100
  Re: Include file in localhost "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-11 09:56 +0100
  Re: Include file in localhost LômCôm Toàn <huynhtoan.it@gmail.com> - 2013-04-14 18:41 -0700

csiph-web