Getting Base URLs?

First off, I am new here. I have already started using the CodeIgniter Framework (In place of just going from a few classes I used). I love how easy it is to customize the scripts for my customers, and for my own scripts. But, I have a few questions about style.

It seems design is a hassle to get from point A to point B unless there in the same folder. How would I set it up (Or is there already a way) to set a variable for every $this->load->view() to add some variables base on the root URL, such as:

$data['url_image'] = BASE_URL . "/assets/images/";
$data['url_style'] = BASE_URL . "/assets/css/";
$data['url_script'] = BASE_URL . "/assets/js/";

If its already been posted, sorry. I tried to find it the best I could. The docs were not very clear on this either, unless I am blindly missing something. It was helpful for everything thing else (MySQL, Sessions, Captcha, All that stuff).

Sorry if wrong forum. Didn't see a help forum or any post saying "POST IN THIS FORUM FOR HELP" which I know gets Mods really flustercucked Smile


hello I asked the same question yesterday Smile

first you should load the url helper. then you can use the "base_url()" function. after that the way I do and told by others is to design your view files like this '<img src="<?php echo base_url(); ?>assets/test.png" alt="" />' And then you can place your asset folder to the base directory (where the CI index.php is)

Oh, thanks! Yeah, thats exactly what I needed. Thats about the fastest response I ever got on one of these sites Smile. Like I said, I blindly ignored the "URL Helper", the two keywords I should have been looking for xD.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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