This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// env condition: | |
if (globalConfigs.env == 'dev') {} | |
// jQuery DOM manipulation: | |
$('#example').html(globalConfigs.i18n.example); | |
// jQuery ajax call: | |
$.get(globalConfigs.urls.ajaxAutocomplete, function(data) {}); | |
// enjoy! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function configure() | |
{ | |
$this->dispatcher->connect('context.load_factories', array($this, 'listenToContextLoadFactoriesEvent')); | |
} | |
public function listenToContextLoadFactoriesEvent(sfEvent $event) | |
{ | |
$event->getSubject()->getResponse()->addJavascript($event->getSubject()->getRouting()->generate('javascript_configs')); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript_configs: | |
url: /js/configs.:sf_format | |
param: { module: js, action: configs, sf_format: js } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var globalConfigs = { | |
env : '<?php echo sfConfig::get('sf_environment') ?>', | |
userCulture : '<?php echo $sf_user->getCulture() ?>', | |
urls: { | |
ajaxAutocomplete : '<?php echo url_for('@homepage') ?>', | |
ajaxModalBox : '<?php echo url_for('@homepage') ?>' | |
}, | |
i18n: { | |
example : "<?php echo esc_specialchars(__('example')) ?>", | |
exampleModalboxTitle : "<?php echo esc_specialchars(__('example_modalbox_title')) ?>" |
NewerOlder