Blesta Addons Posted July 27, 2015 Report Share Posted July 27, 2015 Hello i have this code, the js file is well loaded , but the css file is not loaded $(this).blestaSetHeadTag('script', {type:'text/javascript', src:'". $this->view_dir ."js/jquery.modal.js'}); $(this).blestaSetHeadTag('link', {type:'text/css', rel:'stylesheet' , href:'". $this->view_dir ."css/styles.css'}); this code is working well of css $('head').append('<link rel=\"stylesheet\" href=\"". $this->view_dir ."css/styles.css\" type=\"text/css\" />'); is thier any tip or param missed in the blestaSetHeadTag function ? Quote Link to comment Share on other sites More sharing options...
Tyson Posted July 30, 2015 Report Share Posted July 30, 2015 Are you sure only the CSS is not loaded? It looks like you're using $this->view_dir outside of PHP. I would guess this is the problem with each of the URLs you listed. e.g. this: $(this).blestaSetHeadTag('script', {type:'text/javascript', src:'". $this->view_dir ."js/jquery.modal.js'}); should be: $(this).blestaSetHeadTag('script', {type:'text/javascript', src:'<?php echo $this->Html->safe($this->view_dir ."js/jquery.modal.js");?>'}); Michael 1 Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted July 30, 2015 Author Report Share Posted July 30, 2015 Are you sure only the CSS is not loaded? Yes, only the css is not loaded , the js file is well loaded, i use console and firebug developer tools to check what is loaded or not . and the second jquery code is working well for css . It looks like you're using $this->view_dir outside of PHP. I would guess this is the problem with each of the URLs you listed. e.g. this: $(this).blestaSetHeadTag('script', {type:'text/javascript', src:'". $this->view_dir ."js/jquery.modal.js'}); should be: $(this).blestaSetHeadTag('script', {type:'text/javascript', src:'<?php echo $this->Html->safe($this->view_dir ."js/jquery.modal.js");?>'}); no, the same links is working for other methods and blestaSetHeadTag for JS file , and is working without any issue . i have replaced blestaSetHeadTag for css with append jquery and it work like a charm . i'm posed the uestion that to know is there is an issue with this . this case is fronted with the setHTML() function . when i use blestaSetHeadTag in the view it work also . Quote Link to comment Share on other sites More sharing options...
Tyson Posted July 31, 2015 Report Share Posted July 31, 2015 Oh, are you using blestaSetHeadTag in a module? If so, check the path to the javascript file. Is it /components/modules/your_module/views/default/js/jquery.modal.js ? If so, are you sure a <script> tag is not being added to the <head> along with the CSS? There shouldn't be an issue setting the javascript file if you can also set a CSS file. Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted July 31, 2015 Author Report Share Posted July 31, 2015 Oh, are you using blestaSetHeadTag in a module? If so, check the path to the javascript file. Is it /components/modules/your_module/views/default/js/jquery.modal.js ? If so, are you sure a <script> tag is not being added to the <head> along with the CSS? There shouldn't be an issue setting the javascript file if you can also set a CSS file. The Path is correct , the blestaSetHeadTag is set correctly the js file , but is not with css . the same code i used in the view pdt file and is working . is not working in the sethtml() function just or the css file . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.