Skip to main content

Posts

Showing posts from March, 2015

Bootstrap panel accordion with icons

Bootstrap panel accordion with icons HTML <div id="accordion" class="panel-group"> <div class="panel panel-default"> <div class="panel-heading"> <h5 class="panel-title"> <a href="#collapseOne" data-parent="#accordion" data-toggle="collapse" class="accordion-toggle">Profile</a> </h5> </div> <div class="panel-collapse collapse in" id="collapseOne"> <div class="panel-body"> <p>Hello Sudhir</p> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h5 class="panel-title"> <a href="#collapseTwo" data-parent="#accordion" data-toggle="collapse" class="accordion-toggle">Profile</a> </h5> ...

Google Analytics in Cakephp

Implementation of Google analytics in cakephp. Create a element for it. app/views/elements/google-analytics.ctp : <?php $gaCode = Configure::read('google-analytics.tracker-code'); if ($gaCode) { $googleAnalytics = <<<EOD <script type="text/javascript">   var _gaq = _gaq || [];   _gaq.push(['_setAccount', '$gaCode']);   _gaq.push(['_trackPageview']);   (function() {     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);   })(); </script> EOD; echo $googleAnalytics; } ?> Call the element where you want. The best place to call element in layout. <?php echo $this->element('google-analytics...

Cakephp Route

If you want like this example.com/article/show-by-day.html example.com/article/slug-post.html Shows above url in route file like this Router::connect('/article/show_by_day',array('controller' => 'posts', 'action' => 'show'), array('pass' => array('show_by_day'))); Router::connect('/article/slug-post',array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug'))); Router::connect('/article/slug-post/:slug', array('controller' => 'posts', 'action' => 'view'), array('pass' => array('slug'))); if route like Router::connect('/account', array('controller' => 'clientcontacts', 'action' => 'index', 'account' => true)); then its controller function is public function account_index() { }  its view file...