I am sure I saw a Trongate helper function that enabled you to load libraries / stylesheets easily into the Head, but I cannot for the life of me find it.
Can anyone point me to the right place.
Thanks
Helper to load external libraries and stylesheets
5 years ago
5 years ago
#1
5 years ago
#2
Hello DaddyJohn,
First, In your other questions that you asked, if someone has given you a correct answer to your question, Could you please click the Star in the upper right corner to close out the thread.
Thanks
Regard to your question.
CSS files. There is not a helper. Calling the css file depends on its location.
For example, If you create a module, keep all relevant files in the module, like the assets/css folder. Because this will enable you to copy and paste the module into any app.
I have taken phpMailer and made a module out of it. It take alot of trial and error to get the file structure working right.
There are no Helpers for libraries. That said, It depends on the library you want to load.
Can you share what library? Or is this just a general question?
Dan
First, In your other questions that you asked, if someone has given you a correct answer to your question, Could you please click the Star in the upper right corner to close out the thread.
Thanks
Regard to your question.
CSS files. There is not a helper. Calling the css file depends on its location.
For example, If you create a module, keep all relevant files in the module, like the assets/css folder. Because this will enable you to copy and paste the module into any app.
I have taken phpMailer and made a module out of it. It take alot of trial and error to get the file structure working right.
There are no Helpers for libraries. That said, It depends on the library you want to load.
Can you share what library? Or is this just a general question?
Dan
5 years ago
#3
Thanks DC, you are right, I was thinking of $additional_includes_top which I just found.
The reason why I was looking for it, is that I am working through the Goldmine tutorial. When I got to Lesson 18 I had to refactor the form in add_to_cart to change the closing form tags to echo form_close();
This solved one problem, but now when store_items/display/ is loading, I am getting issues with the stylesheet loading with a console message of DevTools failed to load source map: Could not load content for http://localhost/goldmine/css/defiant.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
I thought perhaps loading defiant css via $additional_includes_top might help, but I dont hold out much hope.
The reason why I was looking for it, is that I am working through the Goldmine tutorial. When I got to Lesson 18 I had to refactor the form in add_to_cart to change the closing form tags to echo form_close();
This solved one problem, but now when store_items/display/ is loading, I am getting issues with the stylesheet loading with a console message of DevTools failed to load source map: Could not load content for http://localhost/goldmine/css/defiant.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
I thought perhaps loading defiant css via $additional_includes_top might help, but I dont hold out much hope.
5 years ago
#4
Try removing this line from defiant.css:
/*# sourceMappingURL=defiant.css.map */
/*# sourceMappingURL=defiant.css.map */
5 years ago
#5
I already had removed this.
5 years ago
#6
It is useful to have a helper to add in custom stylesheets/scripts on a per-page basis but it does mean the you have to hand over some control of the 'head' element of the output back to the framework, which may be undesirable.
As a work around, in your controller, add to the view data a small array of the HTML attributes of the link, for example a stylesheet:
Then in your view, you can loop through 'extraStylesheets' and reconstruct the HTML tags in the head section of your output.
(I had trouble posting the code to reconstruct them here - sorry.)
As a work around, in your controller, add to the view data a small array of the HTML attributes of the link, for example a stylesheet:
Then in your view, you can loop through 'extraStylesheets' and reconstruct the HTML tags in the head section of your output.
(I had trouble posting the code to reconstruct them here - sorry.)
5 years ago
#7
Your browser may be caching the request for the css.map file in that case. Maybe a hard refresh will clear the console error.