Sitemap for SEO
May 1, 2012

So you have been relying on webcrawlers to get your sites up and running? Well, if you used a framework like Cakephp or CodeIgniter, you can generate an xml sitemap and ping google, yahoo, bing or babylon and within an hour your site is recognized. I noticed that the webcrawler thing takes a couple of weeks and I refused to accept that any longer. Here is just a snippet of code which does the work. I installed the methods in a library and called them from my controller. Come on now, you are a programmer so break out of the caveman days when cavemen used to let their site sit there until it gets noticed. You can also put social media links on your site to get it noticed!

  1. function index()
  2. {
  3. $sitemap = new google_sitemap; //Create a new Sitemap Object
  4. date_default_timezone_set('UTC');
  5. $item = new google_sitemap_item(base_url()."MY_WEBSITE_URL",date("Y-m-d"), 'weekly', '0.8' ); //Create a new Item
  6. $sitemap->add_item($item); //Append the item to the sitemap object
  7. $sitemap->build("./sitemap.xml"); //Build it...
  8. //Let's compress it to gz
  9. $data = implode("", file("./sitemap.xml"));
  10. $gzdata = gzencode($data, 9);
  11. $fp = fopen("./sitemap.xml.gz, w);
  12. fwrite($fp, $gzdata);
  13. fclose($fp);

Introduction to CodeIgniter
February 3, 2012

Wow, I was suprised by the freedom of this framework. CI does not require the strict structure that Cakephp requires. There is no automagic here, you have to write a little more code and you have a few less helpers. Ci also has less of a community than Cake, but for me...I needed the community for the frameworks I grew up on which was Cake. It's all good, though. Ci is supposedly faster, but what's a few hundredths of a millisecond between friends? Have fun!

Okay, so it took me 2 days to recreate this site in CI. This is a first time for me to have 1 database feeding 2 frameworks. Some feature code is soon to follow.

Pagination with CI
November 30, -0001

Pagination with CI is so easy. Here is my controller function

  1. public function hits(){
  2.     $this->load->library('session');
  3.     if( $this->session->userdata('login_state') !== TRUE ){
  4.          redirect('admin/');
  5.         }
  6.     $this->load->library('pagination');
  7.     $config['base_url'] = base_url().'index.php?/admin/hits/';
  8.     $query_str2 = "SELECT * FROM track";
  9.     $query2 = $this->db->query($query_str2);
  10.     $config['total_rows'] = $query2->num_rows();
  11.     $config['per_page'] = '10';
  12.     $config['num_links'] = '10';
  13.     $config['full_tag_open'] = '
  14.     $config['full_tag_close'] = '';
  15.     $this->load->library('table');
  16.     $this->table->set_heading('ID', 'Address', 'Date');
  17.     $this->load->model('Homey');
  18.     $query = $this->db->order_by('date', desc);
  19.     $query = $this->db->get('track', $config['per_page'], $this->uri->segment(3));
  20.     $data['hits'] = $query->result_array();
  21.     $data['stats'] = $this->Homey->get_hit_stats();
  22.     $this->pagination->initialize($config);
  23.     $this->load->view('admin_head');
  24.     $this->load->view('hit_view', $data);
  26. }

This side banner is Jquery.

Jquery can give your site life. Besides creating games, you can animate anything you want to.

Coming Soon

This text will be a news feed.

Powered by
    © 2017
(default) 24 queries took 7 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `ffarticles`10101
2DESCRIBE `caketemplates`220
3SELECT `Caketemplate`.`id`, `Caketemplate`.`name` FROM `caketemplates` AS `Caketemplate` WHERE `Caketemplate`.`id` = 1 110
4DESCRIBE `mettas`881
5SELECT `Metta`.`id`, `Metta`.`controller`, `Metta`.`title`, `Metta`.`desc_name`, `Metta`.`desc_content`, `Metta`.`keywords`, `Metta`.`logo`, `Metta`.`updated_at` FROM `mettas` AS `Metta` WHERE `Metta`.`controller` = 'ffarticles' 110
6SELECT COUNT(*) AS `count` FROM `ffarticles` AS `Ffarticle` WHERE 1 = 1 110
7SELECT `Ffarticle`.`id`, `Ffarticle`.`order`, `Ffarticle`.`heading`, `Ffarticle`.`article`, `Ffarticle`.`image1`, `Ffarticle`.`image2`, `Ffarticle`.`image2_text`, `Ffarticle`.`code`, `Ffarticle`.`link`, `Ffarticle`.`date` FROM `ffarticles` AS `Ffarticle` WHERE 1 = 1 LIMIT 2014140
8SELECT COUNT(*) AS `count` FROM `ffarticles` AS `Ffarticle` WHERE 1 = 1 110
9SELECT `Ffarticle`.`id`, `Ffarticle`.`order`, `Ffarticle`.`heading`, `Ffarticle`.`article`, `Ffarticle`.`image1`, `Ffarticle`.`image2`, `Ffarticle`.`image2_text`, `Ffarticle`.`code`, `Ffarticle`.`link`, `Ffarticle`.`date` FROM `ffarticles` AS `Ffarticle` WHERE 1 = 1 LIMIT 2014140
10DESCRIBE `fftopics`551
11SELECT `Fftopic`.`id`, `Fftopic`.`topic`, `Fftopic`.`art_num`, `Fftopic`.`sub_id`, `Fftopic`.`total` FROM `fftopics` AS `Fftopic` WHERE `Fftopic`.`id` = 6 110
12SELECT `Fftopic`.`id`, `Fftopic`.`topic`, `Fftopic`.`art_num`, `Fftopic`.`sub_id`, `Fftopic`.`total` FROM `fftopics` AS `Fftopic` WHERE `Fftopic`.`id` = 6 110
13SELECT `Ffarticle`.`id`, `Ffarticle`.`order`, `Ffarticle`.`heading`, `Ffarticle`.`article`, `Ffarticle`.`image1`, `Ffarticle`.`image2`, `Ffarticle`.`image2_text`, `Ffarticle`.`code`, `Ffarticle`.`link`, `Ffarticle`.`date` FROM `ffarticles` AS `Ffarticle` WHERE `Ffarticle`.`link` = 6 ORDER BY `Ffarticle`.`order` ASC 331
14DESCRIBE `photos`551
15DESCRIBE `albums`770
16SELECT `Album`.`id`, `Album`.`name`, `Album`.`menu_name`, `Album`.`file_name`, `Album`.`title`, `Album`.`big_file`, `Album`.`small_file` FROM `albums` AS `Album` WHERE 1 = 1 330
17SELECT COUNT(*) AS `count` FROM `fftopics` AS `Fftopic` WHERE 1 = 1 110
18SELECT `Fftopic`.`id`, `Fftopic`.`topic`, `Fftopic`.`art_num`, `Fftopic`.`sub_id`, `Fftopic`.`total` FROM `fftopics` AS `Fftopic` WHERE 1 = 1 LIMIT 20550
19DESCRIBE `ffsites`441
20SELECT COUNT(*) AS `count` FROM `ffsites` AS `Ffsite` WHERE 1 = 1 110
21SELECT `Ffsite`.`id`, `Ffsite`.`link`, `Ffsite`.`image`, `Ffsite`.`caption` FROM `ffsites` AS `Ffsite` WHERE 1 = 1 LIMIT 20330
22DESCRIBE `banners`551
23SELECT `Banner`.`id`, `Banner`.`topic`, `Banner`.`text`, `Banner`.`link`, `Banner`.`date` FROM `banners` AS `Banner` WHERE 1 = 1 220
24SELECT `Banner`.`id`, `Banner`.`topic`, `Banner`.`text`, `Banner`.`link`, `Banner`.`date` FROM `banners` AS `Banner` WHERE 1 = 1 220