Welcome Guest, Not a member yet? Register   Sign In
Updating config/routes.php using mysql
#2

[eluser]robert.fulcher[/eluser]
I think the write_file will replace the contents and append. so try it like this...

Code:
function update_routes()
    {
            $this->db->select("*");
            $query = $this->db->get("articles");
            foreach ($query->result() as $r)
                {
                    $data = $data.'$route["' . $r['link'] . '"] = "' . $r['route'] . '";';
                }
            write_file(APPPATH . 'cache/routes.php', $data);                
    }

You might need to put a newline character in-between $data & $route.

Hope this helps.


Messages In This Thread
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 04:44 AM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 09:03 AM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 09:55 AM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 12:14 PM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 12:27 PM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 12:51 PM
Updating config/routes.php using mysql - by El Forum - 07-14-2014, 12:53 PM
Updating config/routes.php using mysql - by El Forum - 08-20-2014, 01:51 PM
Updating config/routes.php using mysql - by El Forum - 08-20-2014, 03:12 PM
Updating config/routes.php using mysql - by El Forum - 08-21-2014, 01:46 AM
Updating config/routes.php using mysql - by El Forum - 08-21-2014, 07:34 AM
Updating config/routes.php using mysql - by El Forum - 08-21-2014, 08:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB