Posts

Showing posts with the label CodeIgniter

2021 Top 4 Best Upcoming Flagship Smartphones : which are the best mobile phones for you..?

Image
  Hi here are the top 8 best upcoming flagship smartphones of 2021 with high-end level features improved cameras stunning design and many other next-generation technologies will be applied that you will really enjoy also the price and the release date of the smartphones are discussed. Number four Asus Zenfone 8 Number three OnePlus 9 Number two Huawei P50 Number one Apple iPad Pro 12.9

Codeigniter subdomains sharing one common app

Image
I assume that your are using Windows-7 WAMP Apache 2.4.2 (installed in C: directory) PHP 5.4.3 CodeIgniter 2.x   Download Hi there, the first question raises I our mind is  How to add a sub-domain to be reached at: subdomain.mainsite? So, here we start to create sub-domain for localhost. Step 1: Edit the file located in C:\windows\system32\drivers\etc\hosts add the following to it 127.0.0.1 subdomain.mainsite Save File Step 2 : Edit the httpd.conf file Add the following to the bottom of the file ########################## NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> DocumentRoot "C:\wamp\www" ServerName localhost </VirtualHost> <VirtualHost 127.0.0.1> DocumentRoot "C:\wamp\www\mainsite" ServerName subdomain. mainsite ErrorLog logs/subdomain_error.log </VirtualHost> ########################### Step 3: You must make sure the subdomain directory exists inside mainsite(CodeIgniter).

Unlink file in CodeIgniter

If you try to use unlink in CI as $filestring  =  base_url ( ) . 'uploads/' . $ filename ; unlink  (  $filestring ) ; you will face such error message: A PHP Error was encountered Severity: Warning Message: unlink() [function.unlink]: http does not allow unlinking Filename: controllers/face.php Line Number: 109 because CI does not understand the  path we specified, therefore to remove a file we have to either use: $filestring  =  APPPATH . '../uploads/' . $filename ; unlink ($filestring) ; or   define ( 'PUBPATH' , str_replace ( SELF , '' , FCPATH ));  // in index.php and $filestring  =  PUBPATH . 'uploads/' . $ filename ;    // in controller

Creating SEO friendly URLs with the merger of Wordpress and CodeIgniter

Objective: Suppose you are required to create SEO friendly URLs with the merger of WP and CI, WP as front-end and CI as admin panel. You are adding projects with CI and showing detail of that project with WP. Steps: Code in controller (project.php) // create user friendly url string as per project name $pro_name = “new project name”; $pro_url = strtolower(str_replace(' ','-',trim($pro_name))); // insert in to wp_posts table $post = array( 'post_title' => $pro_name, 'post_name' => $pro_url, 'post_type' => 'page' ); $post_id = $this->utility_model->set('wp_posts', $post); // insert in to wp_postmeta table $postmeta = array( 'post_id' => $post_id, 'meta_key' => '_wp_page_template', 'meta_value' => 'project-detail.php' ); $this->utility_model->set('wp_postmeta', $postmeta); /* insert in to