Hi guys, I have a question regarding the view.yml file in Symfony. Basically I would like to be able to include certain javascript SDKs in my layout with the help of the view.yml file like so:
first i would add an entry the the corresponding view file:
all:
load_facebook: true
load_twitter: true
stylesheets:
javascripts:
and then in the layout do something like:
<?php if (sfConfig::get('view_load_facebook', true)): ?>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo sfConfig::get('app_facebook_comment_app_id') ?>',
status: true,
cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php endif; ?>
Unfortunately I am unable to get the option with sfConfig::get('view_load_facebook') thus I'm guessing they have never been loaded. Has anyone got something like this to work? I think it would be a very good idea to have this option in the view.yml file as it would be very easy implement and very flexible.
Thanks,
Vince