I have quite a lot of PHP view files, which I used to include in my controllers using simple include statements. They all use methods declared in a view class which they get like $view->method(); However I recently decided that it would be better if the including would also be done by this view class. This however changes the scope of th...
I'm trying to implement caching for a PHP script I'm writing, but I keep running into the following problem. I want the script to be included in other PHP pages, but when I try to pass the cached file and exit the embedded script it exits both the script and the parent page, but doesn't parse the rest of the code on the parent page. Se...
<?php
if (preg_match('/^[a-z0-9]+$/', $_GET['page'])) {
$page = realpath('includes/'.$_GET['page'].'.php');
$tpl = realpath('templates/'.$_GET['page'].'.html');
if ($page && $tpl) {
include $page;
include $tpl;
} else {
// log error!
}
} else {
// log error!
}
?>
How safe would you say this is?
Gumbo here on Stack Overflow ...
Warning: include(/2008/2009/assets/inc/base/error.inc.php) [function.include]:
failed to open stream: No such file or directory in
C:\Program Files\Apache Group\Apache2\htdocs\2008\2009\assets\inc\base\header.inc.php on line 82
I am receiving the above error when including a file on a WAMP setup. Is it possible that Windows is interpre...
In C++, what is the convention for including headers for class files in the "main" file. e.g.
myclass.h
class MyClass {
doSomething();
}
myclass.cpp
doSomething() {
cout << "doing something";
}
run.cpp
#include "myclass.h"
#include "myclass.cpp"
etc..
Is this relatively standard?
...
I'd like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I'd really like a universal approach here, as in the library case.
...
I'm trying to add an element to an array only if it doesn't already exist in the array. I used to do this with the Array.include method of mootools, but now I'm using jquery.
Is there a method to do this in jquery?
http://mootools.net/docs/Native/Array#Array:include
...
Given the following:
large project with thousands of C++ source files
no common header file (no one header that's included in every source file)
said project is compiled with g++ and managed by make
Is there any way to include a definition (e.g. macro) into every compilation unit without modifying every source file to include a new h...
If I include a an external actionscript file in a flex mxml file, I get different behaviours at compile time depending on the method used. Using an mx script tag with a source attribute or an include statement, then compiling the file gives errors like:
Error: Packages cannot be nested.
If use import these errors go away and the file ...
A. What does this do?
require ("./file.php");
B. in comparison to this?
require ("file.php");
(Its not up-one-directory.. which would be)
require ("../file.php");
...
I have a PHP file at my server root.. index.php .. which include's .. DIR/main.php
Now .. DIR/main.php .. has relative links to many nearby files.
All the relative links are broken.
Any way I can change the relative-URL base path for links?
... so the included content of DIR/main.php has all its links to friend1.php changed to DI...
I've reviewed questions How to use include directive correctly and C++ #include semantics and neither addresses this - nor do the others suggested by SO when I typed the title...
What, if any, are the benefits of writing:
#include "../include/someheader.h"
#include "../otherdir/another.h"
compared with using just a plain file name:
...
Hi. I'm trying to build a project in Visual Studio 2008. I'm getting a bunch of linker errors that are really bothering me. My application is a Win32 console application using only native ANSI C++.
They are all linker errors of the same pattern.
Linker errors are related to every single private static data member of classes I have defin...
Very quick n00b question, in PHP can I include a directory of scripts.
i.e. Instead of:
include('classes/Class1.php');
include('classes/Class2.php');
is there something like:
include('classes/*');
Couldn't seem to find a good way of including a collection of about 10 sub-classes for a particular class.
...
Good design dictates only writing each function once. In PHP I'm doing this by using include files (like Utils.php and Authenticate.php), with the PHP command include_once. However I haven't been able to find any standards or best practices for PHP include files. What would you at StackOverflow suggest?
I'm looking for:
Naming St...
I often find that the headers section of a file get larger and larger all the time but it never gets smaller. Throughout the life of a source file classes may have moved and been refactored and it's very possible that there are quite a few #includes that don't need to be there and anymore. Leaving them there only prolong the compile time...
I know that it is poor performance to use relative paths when including a file in php. But, is this true for for all paths or just paths relative to the assumed (context) include path?
Is this line
require '/home/../http/test.php'
as fast as this line
require '/http/test.php'
...
I am running multiple PHP apps on my Mac, running OS X 10.5.6, Apache 2, PHP 5. I have subdomains setup for each project, a host file entries for each subdomain, and Virtual Directory blocks in the Apache config. So
project1.localhost goes to /Library/WebServer/Documents/Project1
project2.localhost goes to /Library/WebServer/Documen...
I have looked in The C++ Programming Language to try to find the answer to this. When I #include "my_dir/my_header.hpp" in a header, where does it look for this file? Is it relative to the header, relative to the source file that included it, or something else?
...
Hello,
I am using qt and developing a desktop app that will run under win xp/vista.
I have a 3rd party library UserAgentLib (static, and shared). But I am not sure how to link in qt creator.
I have opened the *.pro file and added my library and header path.
The library is called UserAgentLib and the header file is called UserAgentLib...