Monthly Archives: August 2012

Symfony2: simple JavaScript routing with Assetic and HTML5 data Attributes

Simple example HTML5 code: <div id=”gallery” data-rollover_on=”{{ asset(‘bundles/testprojecttestbundle/images/play_button_on.png’) }}” data-rollover_off=”{{ asset(‘bundles/testprojecttestbundle/images/play_button_off.png’) }}”> …</div> JavaScript (JQuery): var rollover_play_off = mainjQuery(‘div[id=”gallery”]’).attr(‘data-rollover_off’); var rollover_play_on = mainjQuery(‘div[id=”gallery”]’).attr(‘data-rollover_on’); var original_image = ‘url(‘+rollover_play_off+’)’; var second_image = ‘url(‘+rollover_play_on+’)’;

Posted in assetic, Symfony2 | Leave a comment

Symfony2: assetic, rewriting image paths in CSS

Twig template: {% block stylesheets %} {{ parent() }} {% stylesheets filter=’cssrewrite’ output=’css/*.css’ ‘bundles/testcompanytestbundle/css/*’ %} <link href=”{{ asset_url }}” type=”text/css” rel=”stylesheet” /> {% endstylesheets %} {% endblock %} Console commands: php app/console assets:install web/ php app/console –env=prod assetic:dump CSS example … Continue reading

Posted in assets, CSS, rewrite, Symfony2 | Leave a comment

Facebook API: Like button event problem (FB.Event.subscribe(‘edge.create’…)

Original problem: FB API edge.create method not fired on Like with URL different from current page. Bug link: I’ve solved the problem. You have to use the url_like table: //Facebook API – Unlike event. FB.Event.subscribe(‘edge.remove’, function(response) { console.log(‘uid’,uid); var … Continue reading

Posted in edge.create, Facebook, JavaScript, like event | Leave a comment