Welcome Guest, Not a member yet? Register   Sign In
Maybe you can help, Global variables?
#5

[eluser]Chad Fulton[/eluser]
Or, you could do it one better, and essentially overwrite the base_url() function to accept a parameter, which would tell it whether or not to append the index.php part. This would probably be the best option, because if you fix the ISAPI_REWRITE problem, then you could simply remove the MY_url_helper.php file and all of your links would automatically use the normal base_url() function without having to change a thing.

Code:
// Note: most of the code in this function is copied directly from
// the original CI base_url() function
function base_url($append_index = false) {
    $CI =& get_instance();
    $base_url = $CI->config->slash_item('base_url');
    if($append_index) {
        $base_url .= 'index.php/';
    }
    return $base_url;
}

Then, you'd call it like this:

Code:
<a href="&lt;?= base_url(true); ?&gt;this/is/a/link">A link</a>

of course, this won't affect the functions site_url(), current_url(), index_page(), etc.


Messages In This Thread
Maybe you can help, Global variables? - by El Forum - 10-02-2009, 01:49 PM
Maybe you can help, Global variables? - by El Forum - 10-02-2009, 02:45 PM
Maybe you can help, Global variables? - by El Forum - 10-02-2009, 02:48 PM
Maybe you can help, Global variables? - by El Forum - 10-02-2009, 02:50 PM
Maybe you can help, Global variables? - by El Forum - 10-02-2009, 02:56 PM
Maybe you can help, Global variables? - by El Forum - 10-03-2009, 04:05 AM
Maybe you can help, Global variables? - by El Forum - 10-03-2009, 04:56 AM
Maybe you can help, Global variables? - by El Forum - 10-03-2009, 08:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB