Jump to content

Blestasetheadtag For Css


Blesta Addons

Recommended Posts

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 ?

 

Link to comment
Share on other sites

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");?>'});
Link to comment
Share on other sites

 

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 .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...