Accessing Image On CSS with Codeigniter |
My file structure is
Code: application I need to access the image on my css but I cannot seem to get path. What would be the correct path using the background url Code: body {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(07-09-2016, 12:40 AM)ciadmin Wrote: IIRC, the CSS URL is relative to the folder containing the CSS file. The css file is in couple of sub folders in side assets if thats what your meaning in my structure?
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
07-09-2016, 01:37 AM
(This post was last modified: 07-09-2016, 02:40 AM by gxgpet. Edit Reason: fixed paths )
Hi wolfgang1983,
ciadmin is trying to tell you that you should access the CSS file by pointing out directly the path; so, accessing the CSS file should work this way: Code: background: url('./assets/catalog/images/holder.png'); If your project is itself in a subfolder, then you should add that part too: Code: background: url('./projects/my_project/assets/catalog/images/holder.png'); However, as a good practice to point to any of your assets (CSS, JavaScripts, images etc.) you can use the base_url() function from CodeIgniter. More about it here. However, based on your current project structure, you can't use it for this situation because the CSS files don't get processed by PHP, so the function won't be actually called. Hope this helps! ![]()
in order to use holder png's you need to load the holder.js javascript file if it is not loaded.
Here is a method to add to a asset_helper.php PHP Code: /* ------------------------------------------------------------------------ if you want you can change the return to add in your catalog path there. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thanks all got it to work now.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |