How do I generate a friendly URL in Symfony PHP?
I always tend to forget these built-in symfony functions for making links. ...
I always tend to forget these built-in symfony functions for making links. ...
Hi, When using a Zend_Form, the only way to validate that a input is not left blank is to do $element->setRequired(true); If this is not set and the element is blank, it appears to me that validation is not run on the element. If I do use setRequired(), the element is automatically given the standard NotEmpty validator. The thing is...
In the php manual they describe functions like so: string date ( string $format [, int $timestamp ] ) How would this function look when you define it? ...
I have an if statment with two conditions (seperated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed i only want the second condition to be processed if the first condition evaluates to false. if i order the conditions ...
I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links: <A HREF="path to file">filename</A> The filenames can be complicated: LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf What is the correct way to link to this file on a Linux/Apache server? Is there a PHP function to ...
Perhaps the biggest risk in pushing new functionality to live lies with the database modifications required by the new code. In Rails, I believe they have 'migrations', in which you can programmatically make changes to your development host, and then make the same changes live along with the code that uses the revised schema. And roll bo...
I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasonally I see a single pipe used: | What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable? ...
In the project i am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to support emoticons, avatars, or stuff like that. Some project memb...
Can anybody recommend a reliable and decently documented code highlighter for WordPress 2.6.1. I have tried Code Snippet by Roman Roan and Developer Formatter by Gilberto Saraiva. But they don't seem to work as described in the documentation and are mangling the code snippets instead of prettifying them. ...
I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have? I am only familiar with PHP ...
I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed. Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup. Is there a third (or fourth etc) option that I'm not aware of that I sho...
In my PHP webapp, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done? ...
I'm really not confident with Regex, I know some basic syntax but not enough to keep me happy. I'm trying to build a regular expression to check if an email is valid. So far here's what I've got: [A-Za-z0-9._-]+@[A-Za-z0-9]+.[A-Za-z.]+ It needs to take account of periods in the username/domain and I think it works with multiple TLDs ...
What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code. I've tried moving blocks of code out into functions, so now there are functions spread out all thro...
I'm taking the leap: my php scripts will ALL fail gracefully! At least, that's what I'm hoping for... I don't want to wrap (practically) every single line in try...catch statements, so I think my best bet is to make a custom error handler for the beginning of my files. I'm testing it out on a practice page: function customError($leve...
I'm parsing text from a file and storing it in a string. The problem is that some of the text in the original files contains ASCII art and whatnot that I would like to preserve. When I print out the string on the HTML page, even if it does have the same formatting and everything, since it is in HTML, the spacing and linebreaks are not ...
How can I set the cookies in my PHP apps as HttpOnly cookies? ...
Is there a simple way to cache MySQL queries in PHP or failing that, is there a small class set that someone has written and made available that will do it? I can cache a whole page but that won't work as some data changes but some does not, I want to cache the part that does not. ...
I have my Wordpress install and MediaWiki sharing the same login information. Unfortunately users need to log into both separately, but at least they use the same credentials. What I would like to do is cause a successful log in on the Wordpress blog to also cause a log in for MediaWiki (ideally both directions). There are two ways ...
Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform simple arithmetic operations on two of them (add/subtract/mul...