Skip to main content

Posts

Showing posts from May, 2017

Codeigniter MSSQL connection

We can connect the Microsoft SQL Server 2008 R2 rdbms to php with codeigniter framework. For that we need to install sqlsrv driver on our server.  SqlSrv is a php driver for MS SQL  and is available from Microsoft: » http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx. For earlier version of php before  5.3 , the Mssql driver was needed.  The Mssql extension is not available anymore on Windows with PHP 5.3 or later. After we have sqlsrv driver extension added on server, we can check it on our phpinfo page. The sqlsrv should be there. We may need to install the odbc driver too depending on our system configuration. If there is a problem with connecting sql server database, we can debug to know the error. Then we need to add the following configuration on our database configuration file. $db['default'] = array( 'dsn' => '', 'hostname' => '.\sqlexpress', 'username' => '',

OpenCart - How to change url to seo friendly

If we want to make the default url of opencart to seo friendly, we need to modify seo_url.php controller. Firstly, backup your file. Then, in seo_url.php controller, replace the code with below: 1. edit controller/common/seo_url.php <?php class ControllerCommonSeoUrl extends Controller {    public function index() {       // Add rewrite to url class       if ($this->config->get('config_seo_url')) {          $this->url->addRewrite($this);       }           // Decode URL       if (isset($this->request->get['_route_'])) {          $parts = explode('/', $this->request->get['_route_']);          $route = "";                  foreach ($parts as $part) {             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");                       if ($query->num_rows) {