I have got this controller: class Start extends CI_Controller{ var $base; var $css; function Start() { parent::Controller(); //error here. $this->base = $this-&…
Working with two entity managers in the same bundle in Symfony2
I’m trying to work with two entity managers for the same bundle. My configuration is like this: Is there any way to tell which entities belong to which entity manager? It crashes now if I want to work with a table which doesn’t belong to the default entity manager. UPDATE here is my configuration …
Apache Virtual Host not parsing PHP
I decided to enable virtual hosts on my Apache server, and chose to make it port-based. First thing I did, of course, was RTM. I followed the instructions found here. Well, it worked — kind of. As …
How can I keep an HTML snippet in a separate file, plug variables in as needed, and echo it out on demand?
For instance, let’s say I have a snippet of code, which I’d like to keep separate. for now, we’ll call it snippet.php. snippet.php would be a simple block of reusable HTML which would have php variables in it. Something like this: I’d like to be able to return this code from a function…
Using Environment variables in WordPress wp-config
I’m using phpfog.com for hosting and github.com for issue tracking, etc. I have two remotes setup, one to phpfog.com, and the other to github. In the back-end admin of phpfog you can define …
How to detect the screen DPI using JavaScript
The only way I found till now, is getting the offsetWidth, offsetHeight of a test div element with height and width of one inch: http://www.infobyip.com/detectmonitordpi.php Is there a way to detect …
Simplest two-way encryption using PHP
What is the simplest way of doing two way encryption in common PHP installs? I need to be able to encrypt data with a string key, and use the same key to decrypt on the other end. The security isn’t as big of a concern as the portability of the code, so I’d like to be able to keep things
Convert list into an array using php. How?
I have a function called listelements(), which outputs text like <li>text1</li><li>text2</li>. I have more than 500 elements. Now I want to convert it into an array. Can anyone help me? Thanks. Note: I’m using php Update: The thing i want to achieve is alphabetical navigation. As…
How long can a TLD possibly be?
I’m working on an email validation regex in PHP and I need to know how long the TLD could possibly be and still be valid. I did a few searches but couldn’t find much information on the topic. So how long can a TLD possibly be? Answer DNS allows for a maximum of 63 characters for an individual labe…
PHP if statements inside of echo to create HTML option list
I have a HTML option list of 10 numbers. I want one of these options to be pre-selected based on a value retrieved from a database. If the retrieved value is 0 or FALSE then value=”0″ should be selected, if the retrieved value is 1 then value=”1″ should be selected, etc. I have looked …