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...
As maybe some of you know google chrome has put some severe limitation on greasemonkey scripts.
Chromium does not support @require, @resource, unsafeWindow, GM_registerMenuCommand, GM_setValue, or GM_getValue.
And without require, I can't find a way to include jquery library in Greasemonkey script under google chrome.
Does anybod...
Hi,
How do you check if an include / require_once exists before you call it, I tried putting it in an error block, but PHP didn't like that.
I think file_exists() would work with some effort, however that would require the whole file path, and a relative include could not be passed into it easily.
Are there any other ways?
...
I want to put snippets like these inside of a few php files and then require them in my main page, instead of using "pure" css and js files. I mean, I already do essentially this for my HTML DOM.
this:
<script type='text/javascript'>
var foo = <?php echo $bar; ?>;
</script>
or this:
<style type='text/css'>
.foo{
background-image:url...
How would I go about checking if and include or a require has an error in it. For example, and include would try to be included, if that page has an error the page isn't included and a message is throw?
Cheers.
...
In my script, I set the include path (so another part of the application can include files too), check that a file exists, and include it.
However, after I set the include path, file_exists() reports that the file does not exist, yet I can still include the same file.
<?php
$include_path = realpath('path/to/some/directory');
if(!is...
Hi guys,
I've been using APC caching functions and it's been phenomenal. I was thinking, why not just cache all of my functions, and load them whenever I need to (kind of like frameworks actually).
function Foo {echo 'bar';}
$foo = Foo;
apc_store('foo',$foo);
And then whenever Foo is needed, I'd just use apc_fetch. Is that more effic...
I would like to put a large variable definition in a separate file for the sake of getting it out of the way. I must be doing something wrong though, because my puts call isn't putting anything out.
my_class.rb:
class foobar
def initialize
require 'datafile.rb'
puts @fat_data
end
end
datafile.rb:
@fat_data = [1,2,3,4,5,6...
Writing some ruby code (not rails) and I need to handle something like this:
found 1 match
found 2 matches
I have rails installed so maybe I might be able to add a require clause at the top of the script, but does anyone know of a RUBY method that pluralizes strings? Is there a class I can require that can deal with this if the script...
When creating gems, I often have a directory structure like this:
|--lib
|-- helpers.rb
`-- helpers
|-- helper_a.rb
`-- helper_b.rb
Inside the helpers.rb, I'm just require-ing the files in the helpers directory. But I have to do things like this:
$:.push(File.dirname(__FILE__) + '/helpers')
require 'helper_a'...
I use __autoload to load classes, and I keep getting errors that no class is found but file get's loaded ok.
Then if I change something in a file, just something like add a new line and save it, everything works fine and class is then found.
But this is a great problem cause there are thousands of files in this project and I don't want ...
Hello,
I want to make a little script but I'm rather n00b in php so please help me if you can :)
What I want the script to do is:
I have "index.php".
I want "index.php" to read the sub-directories from a known folder, let's say "templates/"
Each sub-directory will contain a file called "content.html".
The index will then load the "co...
Is it more efficient to use PHP's include_once or require_once instead of using c-like include with a header guard?
i.e,
include_once 'init.php';
VERSUS
include 'init.php';
//contents of init.php
if (!defined('MY_INIT_PHP')) {
define('MY_INIT_PHP', true);
...
}
...
Hello,
I am trying to set up a PHP path to my Zend Framework. I am very confused on how to do this. My Zend Framework is located at the following location on my server:
amazon/ZendFramework-1.10.3-minimal
I am going to be creating a couple of php files in the amazon/ directory that will require the Zend Framework. My include path is:
...
Hi
I downloaded the active record library. I dont want to install it as gem in the system. I want to use that by requiring the lib like 'require "active_record"'
How to include the path of the source code of active record. So that I can make my program to execute.
...
I have a particular php class that I want to be able to upload identical copies to two different servers. Depending on the server though, the requires will be located in different places. (the constants and globals are slightly different as well) Can I conditionally set require_once, Globals, or constants at the beginning of the file?
...
I'm doing some trickery with a bunch of Rake tasks for a complex project, gradually refactoring away some of the complexity in chunks at a time. This has exposed the bizarre web of dependencies left behind by the previous project maintainer.
What I'd like to be able to do is to add a specific path in the project to require's list of pat...
from my understanding, require pastes code into the calling php file.
what if you were requiring from inside a method...it would paste the entire code/class inside the method, blocking the next statement in the method.
eg.
function test() {
require 'pathtosomeclasscode';
somestatement; // any code after the require is block...
Hi
As usual you write in Joomla Development
defined('_JEXEC') or die('Restricted access');
I make a plugin which needs access from Paypal/IPN, so i exclude that in that specific file. BUT I also need to use the Joomla-intern Variables to access the Database, so i tried this:
require("../filewithaccesstoframework.php");
OR even...
Hi everybody, this isn't a problem as such but it's bugging me and I would appreciate any help. It might be totally obvious but I can't see it.
$root_path = $_SERVER['DOCUMENT_ROOT']
require($root_path .'template/header.php')
require($root_path .'template/footer.php')
The script will include one or the other but not both. It will ru...