How to reference CSS / JS / image resource in Facelets template?

Introduction The proper JSF 2.x way is using <h:outputStylesheet>, <h:outputScript> and <h:graphicImage> with a name referring the path relative to webapp’s /resources folder. This way you don’t need to worry about the context path as you would do in JSF 1.x. See also How to include CSS relative to context path in JSF 1.x? Folder … Read more

Is there any way to return HTML in a PHP function? (without building the return value as a string)

You can use a heredoc, which supports variable interpolation, making it look fairly neat: function TestBlockHTML ($replStr) { return <<<HTML <html> <body><h1>{$replStr}</h1> </body> </html> HTML; } Pay close attention to the warning in the manual though – the closing line must not contain any whitespace, so can’t be indented.

How to include a sub-view in Blade templates?

You can use the blade template engine: @include(‘view.name’) ‘view.name’ would live in your main views folder: // for laravel 4.X app/views/view/name.blade.php // for laravel 5.X resources/views/view/name.blade.php Another example @include(‘hello.world’); would display the following view // for laravel 4.X app/views/hello/world.blade.php // for laravel 5.X resources/views/hello/world.blade.php Another example @include(‘some.directory.structure.foo’); would display the following view // for Laravel … Read more

Is it possible to use Razor View Engine outside asp.net

There are two issues here: Yes, you can run the Razor View Engine outside of the context of an ASP.NET app domain, as explained in Andrew’s blog: http://vibrantcode.com/blog/2010/11/16/hosting-razor-outside-of-aspnet-revised-for-mvc3-rc.html However, Razor is still primarily focused on generating xml-like markup (e.g. HTML) in the sense that the Razor parser uses the presence of <tags> to determine the … Read more

Passing variables through handlebars partial

Handlebars partials take a second parameter which becomes the context for the partial: {{> person this}} In versions v2.0.0 alpha and later, you can also pass a hash of named parameters: {{> person headline=”Headline”}} You can see the tests for these scenarios: https://github.com/wycats/handlebars.js/blob/ce74c36118ffed1779889d97e6a2a1028ae61510/spec/qunit_spec.js#L456-L462 https://github.com/wycats/handlebars.js/blob/e290ec24f131f89ddf2c6aeb707a4884d41c3c6d/spec/partials.js#L26-L32

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)