CodeIgniter Forums
How to add folders like CDD, images etc. ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: How to add folders like CDD, images etc. ? (/thread-66065.html)



How to add folders like CDD, images etc. ? - planteg - 08-30-2016

Hi all,

my web site is located on a Raspberry Pi zero running raspbian. The web server is appache 2, I installed CodeIgniter under just below var, so above www.

I tried inserting a reference to a style sheet, a .CSS file, but that does not work. Looking at the generated HTML code, it looks like it needs to have the CSS files below http://mydomain.com  Huh.

Does that mean the style sheet needs to be available from within the browser who runs the web site either:

  • from the web site itself
  • or inside the page itself ?
Is there some way I can have the styles outside the header file (view) and reference it from the header ?

Thanks


RE: How to add folders like CDD, images etc. ? - portaflex - 08-30-2016

(08-30-2016, 02:07 PM)planteg Wrote: Hi all,

my web site is located on a Raspberry Pi zero running raspbian. The web server is appache 2, I installed CodeIgniter under just below var, so above www.

I tried inserting a reference to a style sheet, a .CSS file, but that does not work. Looking at the generated HTML code, it looks like it needs to have the CSS files below http://mydomain.com  Huh.

Does that mean the style sheet needs to be available from within the browser who runs the web site either:

  • from the web site itself
  • or inside the page itself ?
Is there some way I can have the styles outside the header file (view) and reference it from the header ?

Thanks

You can put your css code inside your view (which is very ugly). Put the code anywhere in your page just before the elements affected by that css code. Like this:

Code:
<style media='screen' type='text/css'>
.jumbotron {
background: url('images/image.jpg');
color: #fff;
margin-top: 100px;
padding-top: 200px;
min-height: 400px; }
</style>

You can't have any css file outside of webroot, so you can reference the css file in the <head> section of your view (which is more clever), for example like this:

Code:
<link rel="stylesheet" href="http://mydomain.com/assets/bootstrap/css/bootstrap-theme.css" media="all">
This means you have a css file called bootstrap-theme.css inside assets->bootstrap->css folders in your webroot.

Hope this helps. Regards.


RE: How to add folders like CDD, images etc. ? - planteg - 08-31-2016

Hi portaflex,

thanks for your inputs. For css, I managed it this way: I left the css directory on top of www, and in the header view I used require '/var/codeigniter/css/my_style_sheet.css'.

Regarding images, that will not work. If I store images under www it will work, but if I want to use the image library, I need to set permissions to write in the directory, which I dislike. I like the idea with CodeIgniter where the files are on top of www, but for index.php !