Welcome Guest, Not a member yet? Register   Sign In
preg_replace_callback
#3

[eluser]easymind[/eluser]
Ok well. I did not want to make a helper. But ok, it works now with the helper:

Code:
controller:
-----------
$data['page'] = preg_replace_callback(
            '/href=\"!localfile:\d,(\d)/',
            create_function(
                '$matches',
                'return "href=\"".site_url()."files/showtag/".getfiletag($matches[1]);'
            ),
            $this->mp->getPage($tag)
        );


helper:
-------
function getfiletag($id)
{
    $CI =& get_instance();
    $CI->load->model('model_file','mf');
    $file = $CI->mf->getById($id);
    return $file['tag'];
}


Messages In This Thread
preg_replace_callback - by El Forum - 12-06-2007, 08:33 AM
preg_replace_callback - by El Forum - 12-06-2007, 08:56 AM
preg_replace_callback - by El Forum - 12-06-2007, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB