Problems loading a style css from another directory |
Hello!
Today I load a css dynamically as follows: PHP Code: function addStyle($file = '') This works fine, but when I try to load into another directory, the function can not find the style, causing error. Does anyone know of any way to dynamically load the css being able to be in another directory as well? Thank you! (04-02-2019, 11:50 AM)php_rocs Wrote: @Skinper, This code is in a controller that belongs to a project named fw. I call this method on the controller in the MY project. But the method looks for the css only in the fw folder, but I wanted it to look in the MY driver folder. In short, I wanted addStyle to look up the file I want in the controller folder that calls it, for example: If it is called by some controller belonging to fw, it looks in the fw folder. Now if it's called in MY, it looks in the MY folder. The first works well, but the second does not. I tried to use Directory Helper but did not succeed. Thanks !!
@Skinper,
Have you tried creating a backup directory for the system to look into if it is unable to find it in the primary directory? You could also define it in your view header and send a flag (from the controller) to tell the code where to find the CSS. I'm surprised that you don't keep all the assets (images, css, javascript libraries) in a specific location so that it is consistent across the web application. (04-03-2019, 01:51 PM)php_rocs Wrote: @Skinper, I tried this for a flag, but it still does not recognize the css directory. Assets are shared by 2 projects, so it works like a firmware for them. I do not think that's the best way, but it's not in my power to change that now, but thanks for the touch. |
Welcome Guest, Not a member yet? Register Sign In |