Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 389 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where do I put image files, css, js, etc. in Codeigniter?

#11
The `link_tag()` helper is clearly the way to do this. Put your css where it usually belongs, in site_root/css/ and then use the helper:

From [The CodeIgniter docs...][1]

echo link_tag('css/mystyles.css');

Output

<link href="http://example.com/css/mystyles.css" rel="stylesheet" type="text/css" />


[1]:

[To see links please register here]

Reply

#12
I'm using the latest version of CodeIgniter 3.1.0.
The folder structure of it is:



- system
- application
- user_guide
- assets
- images
- js
- css


That's where you should put the images, css and js files inside the assets folder.
Reply

#13
I have a setup like this:

- application
- system
- assets
- js
- imgs
- css

I then have a helper function that simply returns the full path to this depending on my setup, something similar to:

**application/helpers/utility_helper.php:**

function asset_url(){
return base_url().'assets/';
}

I will usually keep common routines similar to this in the same file and autoload it with codeigniter's autoload configuration.

> Note: autoload URL helper for `base_url()` access.

**application/config/autoload.php:**

$autoload['helper'] = array('url','utility');

You will then have access to `asset_url()` throughout your code.
Reply

#14
you can put the css folder inside the assest folder(you name it any name) in the directory of your project as:
<br/>



- ci_app
- application
- views
- assets
- css
- style.css




...
when you want to load that file in a page, you can use base_url()function as this way:
`<head>
<link rel='stylesheet' href='<?php echo base_url();?>assets/css/style.css'>
</head>`
and you are sure to add base_url of your project in the config.php file as this:


$config['base_url'] = 'http://localhost/ci_app';
Reply

#15
I just wanted to add that the problem may be even simpler -

I've been scratching my head for hours with this problem - I have read all the solutions, nothing worked. Then I managed to check the actual file name.

I had "`image.jpg.jpg`" rather than "`image.jpg`".

If you use `$ ls public/..path to image assets../` you can quickly check the file names.

Sounds stupid but I never thought to look at something so simple as file name given the all the technical advice here.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through