#1 January 11, 2013 1:12am

zddpg
Member
Registered: January 11, 2013
Posts: 8

Newbie in need of help

I'm just trying to link to images that have been uploaded. All the links in the database have a {staticroot} in front of them, otherwise I'd be able to link to them just fine.  But this {staticroot} prefix gets in the way of the url. 

Offline

#2 January 11, 2013 1:41am

zddpg
Member
Registered: January 11, 2013
Posts: 8

Re: Newbie in need of help

Ok, well, I managed to get it to work with str_replace. Somehow I doubt that is what you're supposed to do, so if anyone feels like telling me the proper way, feel free.

Offline

#3 January 11, 2013 9:25am

benplum
Administrator
Registered: March 30, 2012
Posts: 54

Re: Newbie in need of help

Fetching module data using the base class functions, like get() or getApproved(), will use the internal function replaceInternalPageLinks() to make sure these variables are replaced with the actual URL set in the config.php file. If you're writing a new function in a custom module, it's best to run each item through the module's get() function:

public function getTeamMembers() {
    $team = array();
    $q = sqlquery("SELECT ...");
    while ($f = sqlfetch($q)) {
        $team[] = $this->get($f);
    }
    return $team;
}

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.