include

register_shutdown_function : registered function cannot include files if terminating on failure?

Greetings, I am writing some code inside a framework for PHP 5.3, and I am trying to catch all errors in a way that will allow me to gracefully crash on client side and add some log entry at the same time. To be sure to also catch parse errors, I am using register_shutdown_function to specifically catch parse errors. Here is the functi...

Is it possible to use php includes to integrate Mint (haveamint.com) into my CMS?

I am currently running a custom CakePHP CMS and I would like to have a .php page which will basically use php includes for Mint from haveamint.com which is also written in PHP. Can I use php include to basically do a nicer version of an iframe inside my cms? ...

change path for include/require only once

I have a lot of sites - all hosted on my server. I want one of them to access file from /vhost which is a directory above httpdocs where the domain is linked. I know that there is an option to change the path in httpd.conf but that is a lot of work to change all the includes in my sites. ...

Include (../x.php) doesn't work on my Linux server why?

In my Xampp I can do : require_once('../myFile.php'); And it works. When I upload the file that do the require_once, it doesn't work. Here is the error on the server: Warning: require_once(../myFile.php) [function.require-once]: failed to open stream: No such file or directory in /home/xxx/public_html/yyyy/testinclude.php on line 1...

Is there a better way to include() a PHP loop that depends on a varying MySQL query?

I have a large PHP loop that I'm re-using in multiple spots on multiple pages of my site. I'd normally just use an include() to set that PHP loop wherever it's needed, but the PHP loop in question makes use of a MySQL query in which I need to change variables (different filters and different LIMITs) for different instances of this PHP l...

Getting the current script executing file name in javascript

Okay, I've been searching for this for way too long already... I'm trying to find out how I can return the filename of the page that's running an included javascript, from inside that javascript. I can easily do this in PHP using $_SERVER['SCRIPT_FILENAME'], but in Javascript this seems to be a lot harder. Do I really need to substri...

Why is .gitignore not including a file prefixed by a !

Hello, My .gitignore file reads as follows: build/ glucosia.xcodeproj/ !glucosia.xcodeproj/project.pbxproj core-plot/framework/build core-plot/framework/CorePlot-CocoaTouch.xcodeproj/ !core-plot/framework/CorePlot-CocoaTouch.xcodeproj/project.pbxproj .DS_Store Classes/.DS_Store Strangely, glucosia.xcodeproj/project.pbxproj is not ign...

#include confusion and classes

I have been making several games with the Allegro API and C++. I have also been putting all my classes in 1 big main.cpp file. I tried many times to make .h and .cpp files, but my big problem is I have trouble with #including at the right place. For example, I want all my classes to access the allegro library without #including allegro.h...

Will including unnecessary php files slow down website?

The question might prompt some people to say a definitive YES or NO almost immediately, but please read on... I have a simple website where there are 30 php pages (each has some php server side code + HTML/CSS etc...). No complicated hierarchy, nothing. Just 30 pages. I also have a set of purely back-end php files - the ones that have ...

MS Visual Studio Project header files...

I am fairly new to developing C/C++ code in MSVS but one of the things that has already confused me is why, after adding a set of source and header files to my project such that they show up respectively under the MSVS folders 'Source Files' and 'Header Files', do I subsequently have to tell the compiler where my header files are under '...

failing to compile a project, missing io.h file

Hello, I fail to compile a C++ project for mobile device with Windows Mobile (Windows CE-based) operating system and Visual C++ compiler from Visual Studio fails with: Error 1 fatal error C1083: Cannot open include file: 'io.h' EDIT I am trying to compile the SQLite amalgamation, the shell.c file includes the call to this io.h bu...

Giving PHP include()'d files parent variable scope

Is there anyway to for an included file to be used in a parent scope to the one it was called in? The following example is simplified, but does the same job. In essence, a file will be included by a function, but would like the scope of the included file to be the scope of where the function that included it was called from. main.php: ...

What requires me to declare "using namespace std;"?

This question may be a duplicate, but I can't find a good answer. Short and simple, what requires me to declare using namespace std; in C++ programs? ...

Simple security question: PHP Includes.

My sample index.php include 'class.php'; $x = new class; include $_GET['page'].'.php'; //checks if isset file_exists and in_array of valid file names before including; I want to make sure the page being included can't be accessed directly. Below are some examples of code I'm placing on the first line of code on the files that are bein...

What's better of require(dirname(__FILE__).'/'.'myParent.php') than just require('myParent.php') ?

Lots of famous PHP scripts including WordPress use dirname(_FILE_).'/myParent.php' instead of just 'myParent.php' when including files in the same directory of the currently running script. Aren't they the same thing? Why do you prefer typing more? Thanks. ...

Powershell Get-ChildItem -Include/-Exclude doesn't filter if passed as an arg to a function

Having a problem getting a filter argument to Get-ChildItem in a function The following works fine and displays a whole list of files: c:\temp\Get-ChildItem -Include deleteme.txt -Recurse Now say I have the following script file starts here filename = GetLastFile.ps1 param([string] $filter) $files = Get-ChildItem $filter Write-Ho...

Question about including html page in PHP

Hi, If I include an HTML page on a PHP page (say, index.php) with the following: <?php include ("../../forms/login/form.html"); ?> Then will form.php show up correctly in index.php? When I say correctly, I mean with all of its images and CSS. The reason I am asking is because that's not the case with me. I tried it out, and it will...

ActiveRecord :include not working for belongs_to with foreign_key

I have a two models set up like this: class User < ActiveRecord::Base # external_id column in database end class UserUpload < ActiveRecord::Base belongs_to :user, :primary_key => "external_id", :foreign_key => "external_user_id" end However, whenever I do upload = UserUpload.find(id, :include => :user) The sql that gets emitte...

Are redundant include guards necessary?

Are 'redundant include guards' necessary in Codegear RAD Studio 2009? Is the compiler smart enough to deal with this on it's own? For example, I might have the following 'include guard' in foo.h: #ifndef fooH #define fooH // ... declaration here #endif and the following 'redundant include guard' in use_foo.h: #ifndef fooH #inclu...

how to declare all your includes in one file that will be loaded in all project in PHP

Hello i'm working on a project but, i'm sick of loading all the libraries in every single page my project directories are something like this |---x (( PHP PAGES )) |--- x1.php (( PHP FILE )) |--- x2.php (( PHP FILE )) |---y (( PHP PAGES )) |--- y1.php (( PHP FILE )) |--- y2.php (( PHP FILE )) |---includes (( LIBRARIES )) a.ph...