I have a question regarding the date_parse_from_format() method: $parsed = date_parse_from_format(“Y d M H:i T”, ‘2012 28 Nov 21:00 CET’); Returns associative array with detailed info about given …
Tag: php
Database Driver MySQLi Error
I am running Moodle test environment on Window Vista having PHP 5.2.10 and MySQL 5.1.36-Community. When I upgrade from Moodle 1.9.9 to 2.0, I am getting the following error. I also tried to change the dbtype=’mysqli’ in config.ini and still see same error. I would really appreciate if you can prov…
permission denied – php unlink
I have two files: b.php and test.txt and the error is: Warning: unlink(test.txt) [function.unlink]: Permission denied why? b.php and test.txt is 777 and the same group/login if I set 777 on the parent directory I can execute unlink but i have to set 777 and back to 755? Answer You (as in the process that runs…
How to redirect the user to detail page after saving a new pod item/record in Pods / WordPress?
After saving a new pod item, I want to redirect the user to the detail page of the newly created record. How can I achieve this? I tried using post_save hooks but it didn’t work. I used the following code: The pod item is created by a shortcode like this: Answer Try this: [pods name=”egitim”…
PHP naming conventions about abstract classes and interfaces
Should an abstract class always be prefixed with Abstract and suffixed with Interface (when it’s an interface)? Is there any standard naming convention, similar to PSR-0 for folder structure/namespaces, but for classes? It seems redundant as the language has literal keywords for this very purpose. Answe…
Google Code Prettify with Markdown is not working
Google Code Prettify is working fine, but when I am using the Markdown content and show the content from the database, Prettify isn’t working properly (link of live result). This is what I am doing: Getting content with <textarea name=”article_content” id=”wmd-input” class=…
PHP – __call all the time
Say we have a class with several protected and/or public methods. I need to perform a check each time a method is called. I could do that check each time i call a method : or But i would like developers neither to have to think about it nor to write it. I’ve thought about using __call to do :
How to declare a global variable in php?
I have code something like this: <? $a="localhost"; function body(){ global $a; echo $a; } function head(){ global $a; echo $a; } function …
How can I prevent additional strings from being added after URLs that end with .php?
our website’s team just discovered that any user can add a slash ‘/’ then any string after a URL that ends with a .php extension and still access the same original page. For example: I can access www….
CakePHP cache i18n translate
When I forget to translate something, somewhere Project VIEW, I change the file /app/Locale/por/LC_MESSAGES/default.po and sending it back to the server. But mostly, this ‘new translation’, takes …