Please describe how to achieve the best structure

#11
[eluser]mvdg27[/eluser]
Why not put the 'images' folder directly under public_html, and use the base_url()-function, provided by the URL helper? That's the way I use image references in my views:

Code:
<img src="&lt;?=base_url()?&gt;images/image1.jpg" width="240" height="9">

Hope that helps,

Cheers, Michiel

#12
[eluser]yannyannyann[/eluser]
Hi,

I use the same kind of system.
But as I have a language system on my base_url() (which gives me either myurl.com/ or myurl.com/fr ) I use the site_url() method to access files, for example :

Code:
&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?=site_url().PATH_CSS?&gt;jScrollPane.css" /&gt;
    &lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?=site_url().PATH_CSS?&gt;styles.css" /&gt;
    &lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?=site_url().PATH_CSS?&gt;jquery.accessible-news-slider.css" /&gt;

and PATH_CSS is an constant (constant.php) that is pointing to "public/css/".

You could do the same structure, so you avoid rewriting all the time the path (if you have a lot of images)

Code:
<img src="&lt;?=site_url().PATH_IMAGE?&gt;image1.jpg" width="240" height="9">

#13
[eluser]slowgary[/eluser]
Why not just put a forward slash at the beginning of each image path to make them absolute?

Code:
<img src='/images/image1.jpg'/>

Then you can put your images folder at root and it won't matter where your views (or whatever page, for that matter) are located.

By the way, you should start a new thread when you need a problem solved. Hijacking another person's thread makes it more difficult for other people to find answers to similar problems.

#14
[eluser]dejitaru[/eluser]
Sometimes I also use
&lt;base href="&lt;?=base_url()?&gt;"&gt;

at the top of my view pages. Then when I need an image I just use <img src='images/image1.jpg'/>

#15
[eluser]adamp1[/eluser]
[quote author="Michael;" date="1236981174"]Greets m_ologin,

I have found the best overall folder structure to be as follows:

/root
-> /administration
-> /core
-> /system
-> /public_html
-> -> /assets
-> -> -> /css
-> -> -> /images
-> -> -> /js
-> -> /uploads
-> -> /themes
-> -> index.php (points to core)
-> -> admin.php (points to administration)
[/quote]

I have to say I quite like this idea. It keeps all the actual files out of what is visible to the user. Also it means multiple sites can exist which use the same database, but only a single admin area is needed, and its not tied to a single application. I may have to think about this for BackendPro in the future.

#16
[eluser]skunkbad[/eluser]
I'd like to have all of my images inside the application directory, but want to mod_rewrite them so they look like they are at root. I've been trying on my local machine with no luck. Any help?

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^css [NC]
RewriteCond %{REQUEST_FILENAME} !^img [NC]
RewriteCond %{REQUEST_FILENAME} !^js [NC]

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]

RewriteRule ^/css/(.*)$ /application/css/$1 [NC]
RewriteRule ^/img/(.*)$ /application/img/$1 [NC]
RewriteRule ^/js/(.*)$ /application/js/$1 [NC,L]


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.