Site name and Javascript
Permalink
Is there a way to get the site name from within a block of javascript?
I have this:
and the brand: 'Theme Name' is where I need the site name.
;(function ($, document, window) { var // default settings object. defaults = { label: 'MENU', duplicate: true, duration: 200, easingOpen: 'swing', easingClose: 'swing', closedSymbol: '►', openedSymbol: '▼', prependTo: '.ccm-page', parentTag: 'a', closeOnClick: false, allowParentLinks: false,
Viewing 15 lines of 27 lines. View entire code block.
and the brand: 'Theme Name' is where I need the site name.
If this is in a view, or similar place where you can use PHP, you could try this.
Example: for testing
Example: in your script
<?php echo Config::get('concrete.site'); ?>
Example: for testing
<script> console.log('<?php echo Config::get('concrete.site'); ?>'); </script>
Example: in your script
brand: '<?php echo Config::get('concrete.site'); ?>',
Do you need the site name in a JavaScript file or in a script tag?