CodeIgniter Forums
how to access directory under: application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to access directory under: application (/showthread.php?tid=3314)



how to access directory under: application - El Forum - 09-24-2007

[eluser]Zulkhaery B[/eluser]
its newbie question,

i trying to save my system image, css and javascript under system/application directory (ie. application/images).

how can i access the images directory?
thx for your answer.

rgds,

Zul


how to access directory under: application - El Forum - 09-24-2007

[eluser]obiron2[/eluser]
Code:
base_url().images/img.jpg

obiron


how to access directory under: application - El Forum - 09-24-2007

[eluser]Zulkhaery B[/eluser]
[quote author="obiron2" date="1190652738"]
Code:
base_url().images/img.jpg

obiron[/quote]

that way, will go to http://mysite.com/images. My images directory under public_html/application/images. If i go to http://mysite.com/application/images, did not work.

-Zul


how to access directory under: application - El Forum - 09-24-2007

[eluser]obiron2[/eluser]
doh!

You are right.

I created a helper which I always include with a function site_url() which returns "base_url() . application/".

then use site_url().images/img.jpg

you could of course include in the helper img_url(), css_url() etc..


You could put these in the config, but you would then lose them if you updated the CI installation.

hth

obiron


how to access directory under: application - El Forum - 09-24-2007

[eluser]Matthew Pennell[/eluser]
Code:
global $application_folder;
$images_directory = base_url() . $application_folder . '/images';
$local_path = BASEPATH . $application_folder . '/images';
At least, I think the variable is called $application_folder, I might be wrong. But that's what you want, anyway. Smile


how to access directory under: application - El Forum - 09-24-2007

[eluser]Zulkhaery B[/eluser]
oh, i forgot 'helper'. thanks, I'll trying

- Zul


how to access directory under: application - El Forum - 09-24-2007

[eluser]wojtekk[/eluser]
saving images in 'system/application directory' is bad idea
its page engine and u shouldnt do that
'http://mysite.com/images'<-thats correct


how to access directory under: application - El Forum - 09-24-2007

[eluser]Zulkhaery B[/eluser]
[quote author="wojtekk" date="1190655266"]saving images in 'system/application directory' is bad idea
its page engine and u shouldnt do that
'http://mysite.com/images'<-thats correct[/quote]

main reason is the image can be viewed as mysite.com/application/images/ on image property, right ?

if yes, my next question, is it possible using .htaccess to route public_html/application/images to public_html/images ? :gulp: