How to set whether display error in php
By the default, whether the php will display error message is controlled by php.ini. If you are using a shared host, you cannot change it. So, you have to add this line of code on the first line of your php file:
PHP
ini_set('display_errors','on'); |
That is to display the error message , To hide all error message, just use this:
PHP
ini_set('display_errors','off'); |
Free & Good Responsive Template for wordpress - Montezuma
I just installed a new template for my blog. The template I chose is Montezuma. That is 100% responsive design and html5. It works fine with desktop and phone too. Moreover, that is very easy to customize.You go -> Apperance - > Montezuma Options, then you can change css and adding the custom elements into the template. That is super easy. I recommend Montezuma to all wordpress users
Check contains a string
In PHP, there is not a simple function similar with C#, such as '"michael".contains("mich")'. However, you can use strpos which is to find the position of the first occurrence of a substring in a string. because if it cannot fund a substring in a string, it will return false. Thus, if it doesn't return false, therefore the substring is existed.
PHP
strpos($address['name'], 'michael')!==false |
Customize a shipment method in Virtuemart
Source:Open Clip Art Using Under Public Domain Attribution
The shipment plugins can configured by zip code to make the shipment method only available within a range of zip code. But not every country has zip code. So, I need to customize the shipment plugin.
To do this customization, I need to put my own code in:
PHP
protected function checkConditions ($cart, $method, $cart_prices) { |
In my case, I need to check values in $address.
PHP Error:call to undefined function json_decode()
Source:Open Clip Art Using Under Public Domain Attribution
I just moved a website to a new server. During the first test, I got an error :call to undefined function json_decode().
That is simple, because by default, my new server has not enable json module in PHP. The solution is going to cpanel to enable json in PHP.