Fahdi’s Personal Blog

Here I share my web ideas

CodeIgniter: How to set your images path automatically for your site

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
February13

Well I was thinking that the old source code I got from the other guy Nouman who was working on this Home Work Center Project that was and is being coded in CodeIgniter was not very much upto date. I fixed the Javascript issues; in fact a lot of them including the JavaScript date picker calendar. It fits well, works on IE 6, IE7, Safari and Firefox; haven’t yet checked with others. But I am sure it will!. Anyhow the problem I was facing was that in different folders in Views for CodeIgniter , if we are using images, we have to use relative URLs in most of the pages, which gets quite troublesome sometimes. As long as it is the CodeIgniter I am working on, I don’t want to use my own includes having setting of the site because this is why we are using CodeIgniter .

Solution:

So cutting short the details, if you want to use the site’s URL and relative paths according to your site’s base url, here is the solution use site_url(). The link contains all the details you will need to use for your views and it also tells which helpers you need to load.

Share and Enjoy:
  • Digg
  • Facebook
  • LinkedIn
  • NewsVine
  • Technorati
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • StumbleUpon
  • Live
  • Print this article!
  • feedmelinks
  • E-mail this story to a friend!
  • Reddit

Email will not be published

Website example

Your Comment: