Welcome Guest, Not a member yet? Register   Sign In
Question about organizing assets
#1

[eluser]Sire[/eluser]
I have a structure like;
application/
- views/
- views/images/*
- views/css/*

In the views when I want to link to an image or the css, is there a constant or function to grab the path to views to make linking to these shorter or easier? Do you keep your images/css/assets outside the system or application path? At the moment I've been using something like img src="/application/views/images/filename.jpg" or link rel="/application/views/css/style.css"
#2

[eluser]überfuzz[/eluser]
It's more a personal style matter that do or do not.

I organise my folders like this.
Code:
application
assets
system


In assets I keep images, javascripts and what have you. Next question, how do you fetch it? If you want to store path in one place I say go for the config file.
In config file
Code:
$config['css'] = "path to css folder in assets."

In models/ system.php
Code:
function get_css()
{
    return $this->config->item('css');
}

In library/ MY_Controller.php
Code:
$this->load->model('system');
$this->data['link_css'] = $this->system->get_css();
#3

[eluser]Sire[/eluser]
Thank you. That helps a great deal.




Theme © iAndrew 2016 - Forum software by © MyBB