Use always www in front of your links.This way search engines will not consider http://yoursite.com different from http://www.yoursite.com Use this code in .htacces (for domain root) RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
In this tutorial you will learn how to setup zend framework 2 acl and check if user has access for current route. If you don`t have testing project , download one from here. Add file module.acl.roles in application/config/ Tip: In fact role resources may be zend framework 2 routes. return array( 'guest'=> array( 'home', 'login', […]
A bit hard this one , but there is a way to convert EU odds to UK odds in php. function eu_to_uk_odds($odds){ if(floor($odds) !== $odds){ $odds = (string) round($odds – 1,2); $oddsArr = explode('.',$odds); $f1 = (int) $oddsArr[0].''.$oddsArr[1]; $f2 = str_pad('1', ($f1 >= 10 ? 3 : strlen($f1) ),'0',STR_PAD_RIGHT); $minDel = $this->gcd($f1,$f2); $odds = $f1 […]
A simple solution to count days between 2 dates is using DateTime method since php 5.3 function getDaysBetweenDates($from,$to,$addLastDay = false){ $d1 = new \DateTime($from); $d2 = new \DateTime($to); if($addLastDay){ $d2->add(new \DateInterval('P1D')); } return $d1 -> diff($d2)->days; } echo getDaysBetweenDates('2013-03-01','2013-03-11'); //10 echo getDaysBetweenDates('2013-03-01','2013-03-11',true); //11 If you need to count the last day too , just pass […]
There is a easy way to get zend framework 2 base path with domain name in layout. 1. In layout.phtml $homeUrl = $this->url('home',array(),array('force_canonical' => true)); 2.Adding home route in module.config.php 'home' => array( 'type' => 'Zend\Mvc\Router\Http\Literal', 'options' => array( 'route' => '/', 'defaults' => array( 'controller' => 'Application\Controller\Index', 'action' => 'index', ), ), ), Simple […]