Updates from August, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • Pablo 11:21 PM on 27 August 2011 Permalink | Reply  

    PHP date()… finding Sunday… 

    This one is simple, but for some reason i was using too many lines of code to get to this same result in just 1 line… U_U :

    $fecha = '2011-08-23';
    echo date("Y-m-d", strtotime($fecha .' sunday') ); // = 2011-08-21
  • Pablo 11:44 AM on 23 August 2011 Permalink | Reply  

    Symfony2: Working with Assetic 

    Well, i finally took the time to read something about Assetic and let me tell you, it’s awesome. This is how it works:

        {% javascripts '@yourBundle/Resources/js/*' output='js/combined.js' %}
        <script src="{{ asset_url }}"></script>
        {% endjavascripts %}

    The code above ( used inside a Twigg template ) will pack all the javascripts inside Resources/js folder and put them all inside a single file called combined.js inside the web/js folder.

    While developing, that process will take a lot of time each time you refresh the page, that’s why you will want to call this command to make Assetic watch for changes every X time to generate a physical version of each file so the files can be served directly to the browser rather than being generated at runtime:

    php app/console assetic:dump --watch

    That will create a bunch of javascripts in the web/js folder, and everytime you change a file in your Resources/js it will be automatically updated in your web/js folder. So now page load times will be optimal.

    Also, on production, one javascript per javascript will be generated, this is fine because this way you can debug them easily. On Development, assetic will pack all the javascript on a single file (in the case of the example above).

    That’s for when you are developing. When deploying to production, you can delete all the files inside the web/js folder (generated by assetic on development) and run this command:

    php app/console assetic:dump --env=prod --no-debug

    That will generate the FINAL version of all the javascripts so that from now on, the browser will be served with physical javascripts and assetic will not be used anymore.

    Remember that everytime you make a change on the javascripts, you will have to run the command above to generate the final version and that will be the files you will have to upload to production.

    For more information go to http://symfony.com/doc/current/cookbook/assetic/asset_management.html

    • phicheth 4:52 PM on 9 September 2011 Permalink | Reply

      you write to get asset from any folder not need to import from bundle.

      If you place js files in /web/assets/js/jquery.js you can use this by example.

      <script src="{{ asset('assets/js/jquery.js') }}" type="text/javascript"></script>

      doSymfony2.0.1-20110909 Ready Edition is a full repo package include all vendors including in symfony 2.0.1 standard edition. Ready Edition – No git request. all you need already include in pack. Accept share hosting, VPS or your own server.

      Detail of work:

      remove ‘/web/’ folder with edit vendors file. can run on share hosting without any issue from remove ‘/web/’ folder.
      update all vendors via git to build a package. you can use git update symfony with ‘ php bin/vendors install ‘ anytime you wanted. to update to new version you must replace ‘deps’ and ‘deps.lock’ files before update new version of Symfony2
      all feature, API and docs please follow from http://www.symfony.com

      Download : http://code.google.com/p/dohew-opensource/

      This is Symfony2 package include all vendors needed ***

      This package update by Phicheth Kijtaow @doHew Media!

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc