Wednesday, November 28, 2012

Format Date in Admin Generator in Symfony

For example, on the index/list page...
    config:
      actions: ~
      fields:  ~
      list:    
        display: [_id, Partner, name, valid_from, valid_to]
        fields: 
          valid_from: { date_format: yyyy-MM-dd }
          valid_to: { date_format: yyyy-MM-dd }

Friday, November 16, 2012

Add AJAX Request to Google Analytics

If you use jQuery you can bind to the global AjaxComplete event to fire a Pageview everytime an Ajax call completes:
jQuery(document).ajaxComplete(function(e, xhr, settings){
  var d = document.location.pathname + document.location.search + document.location.hash;
  _gaq.push(['_trackPageview', d]);
});
Source: http://stackoverflow.com/questions/7737549/google-analytics-and-loading-a-page-using-ajax-get-request