how to get Magento baseUrl through Javascript and then use it in jquery.hello-lightbox.min? -
i'm trying magento baseurl through javascript in head.phtml file, , utilize in jquery.hello-lightbox.min file, need baseurl images.
here's have in head.phtml file:
<?php $baseurl = $this->getbaseurl() ; ?> <script type="text/javascript"> var baseurl = <?php echo $baseurl ; ?> function getbaseurl(baseurl) </script>
then in /js/jquery.hello-lightbox.min have:
(function($){ function getbaseurl(baseurl) { var domain = baseurl } var urrl = 'http://'+domain+'/skin/frontend/default/customtheme/images/lightbox/'; $.fn.lightbox=function(settings)settings=jquery.extend({overlaybgcolor:'#000',overlayopacity:0.8,fixednavigation:false,imageloading: urrl+'lightbox-ico-loading.gif',imagebtnprev:urrl+'lightbox-btn-prev.gif', . . . . . . . . . .
but doesn't work. in fact seems can't pass php variable $baseurl var baseurl in head.phtml
do have ideas?
there syntax errors in main code. think want define function returns base of operations url so:
<?php $baseurl = $this->getbaseurl() ; ?> <script type="text/javascript"> function getbaseurl() { homecoming '<?php echo $baseurl; ?>'; } </script>
then utilize in javascript: (get rid of function getbaseurl(baseurl) ...
stuff there)
var urrl = 'http://'+getbaseurl()+'/skin/frontend/default/customtheme/images/lightbox/';
javascript magento base-url
No comments:
Post a Comment