For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2006 > include in php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author include in php
Shearer

2006-07-15, 6:56 pm

Which is the corresponding in php of asp command:
<!-- #Include file="file.asp" -->
?


Els

2006-07-15, 6:56 pm

Shearer wrote:

> Which is the corresponding in php of asp command:
> <!-- #Include file="file.asp" -->
> ?


<?php include "file.txt" ?>

--
Els http://locusmeus.com/

Now playing: Yes - The Remembering (High the Memory)
-Lost

2006-07-16, 6:56 pm

<?php include "file.txt"; ?>

Do not forget the semicolon.

-Lost


Ørjan Langbakk

2006-07-16, 6:56 pm

Den 16.07.2006 16:09, skriblet -Lost følgende:
> <?php include "file.txt"; ?>
>
> Do not forget the semicolon.


I just use <?php include 'file.inc' ?> - is this wrong?

--
mvh
Ørjan Langbakk
http://www.bergenpchjelp.no
http://www.cubic-design.net
Rik

2006-07-16, 6:56 pm

Ørjan Langbakk wrote:
> Den 16.07.2006 16:09, skriblet -Lost følgende:
>
> I just use <?php include 'file.inc' ?> - is this wrong?



Not wrong, but bad practise.

Grtz,
--
Rik Wasmus


Ørjan Langbakk

2006-07-16, 6:56 pm

Den 16.07.2006 16:27, skriblet Rik følgende:
> Ørjan Langbakk wrote:
>
>
> Not wrong, but bad practise.


Why is it bad practise? I'm relatively new to PHP, and yes, I am a bit
as to when I should use " and ', but in this particular case,
why is the include using '' bad?

--
mvh
Ørjan Langbakk
http://www.bergenpchjelp.no
http://www.cubic-design.net
-Lost

2006-07-16, 6:56 pm

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:37234$44ba4c81$8259c69c$13966@news1
.tudelft.nl...

> Not wrong, but bad practise.
>
> Grtz,
> --
> Rik Wasmus


What Rik said.

If you tend to code *neatly* as it were, you can be assured that it is not the culprit
when a problem does arise.

-Lost


Rik

2006-07-16, 6:56 pm

Ørjan Langbakk wrote:
> Den 16.07.2006 16:27, skriblet Rik følgende:
>
> Why is it bad practise? I'm relatively new to PHP, and yes, I am a bit
> as to when I should use " and ', but in this particular case,
> why is the include using '' bad?



Euhm, I was referring to the semicolon.

both are Bad Practise without semi-colon:
<?php include "file.txt" ?>
<?php include 'file.txt' ?>

Unnecessary extra evaluation in PHP:
<?php include "file.txt"; ?>

Good Practise:
<?php include 'file.txt'; ?>

Unless offcourse you want to use variable name to name your include file,
else '' is better then "".

Grtz,
--
Rik Wasmus


Sheldon Glickler

2006-07-16, 6:56 pm


"Shearer" <shearer@libero.it> wrote in message
news:Od7ug.41579$_J1.500251@twister2.libero.it...
> Which is the corresponding in php of asp command:
> <!-- #Include file="file.asp" -->
> ?
>


I use

<?php require_once("file.xxx" ); ?>

Shelly


Ørjan Langbakk

2006-07-16, 9:56 pm

Den 16.07.2006 16:52, skriblet Rik følgende:
> Ørjan Langbakk wrote:
>
>
> Euhm, I was referring to the semicolon.
>
> both are Bad Practise without semi-colon:
> <?php include "file.txt" ?>
> <?php include 'file.txt' ?>
>
> Unnecessary extra evaluation in PHP:
> <?php include "file.txt"; ?>
>
> Good Practise:
> <?php include 'file.txt'; ?>
>
> Unless offcourse you want to use variable name to name your include file,
> else '' is better then "".
>
> Grtz,


Ah. Then I'm following you - I thought you meant the whole ''-thing,
not only the semicolon - I'll start using that then :)

--
mvh
Ørjan Langbakk
http://www.bergenpchjelp.no
http://www.cubic-design.net
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com