PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Having trouble including files:
i need to include a file at the start of each page. and then in this included file there are some settings that include other files. For example:
<?php
// This is File 1 (Used in different directories for example: content/file1.php, content/my_account/file1.php)
include('file2.php');
// This is File 2 (used in one location: eg. settings/file2.php)
include('misc_settings.php');
?>
if file 1 is in different directories i can just add ../ to work backwards. The problem is includes in file 2. I can't just add ../ to the includes in file 2 to correspond with File 1, coz file 2 needs can be accessed from different directory levels.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
parenthesis are optional but since include(), require() etc. are functions it looks better when you use them. http://us.php.net/manual/en/function.include.php
But it is just matter of preference.
arturm wrote:parenthesis are optional but since include(), require() etc. are functions it looks better when you use them. http://us.php.net/manual/en/function.include.php
But it is just matter of preference.
True I try and avoid them to lessen file size (even though it hardly matters) good point though
arturm wrote:parenthesis are optional but since include(), require() etc. are functions it looks better when you use them. http://us.php.net/manual/en/function.include.php
But it is just matter of preference.