|
Feb 17
2011
|
Codeigniter BlogPosted by kelchuk in Untagged |
|
Codeigniter comes with all sorts of classes to make a custom blog. Once a blog is built with appropriate styling, there could come a time when the view file needs altering in order to display the blog title in the page title(for order and SEO).
The example in this blog entry uses a standard mysql database connection since it will be a mix of Codeigniter classes and good old PHP/mySQL; since view files need database connectivity scripts while controllers do not.
Here is snippet of code that can be used to display the page title of a particular blog entry.
Here is snippet of code that can be used to display the page title of a particular blog entry.
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php include('http://localhost/codeigniterapp/cgi/connect.php'); ?><?php echo $this->input->get_post('id', TRUE); ?><?php if ($query->num_rows() > 0): ?><?php foreach($query->result() as $row): ?>
<link rel="stylesheet" type="text/css" href="http://localhost/codeigniterapp/css/style.css" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="http://localhost/codeigniterapp/css/ie6.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css" />
<title><?=$row->title; ?></title>
<?php endforeach; ?>
<?php endif; ?></head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<?php include('http://localhost/codeigniterapp/cgi/connect.php'); ?><?php echo $this->input->get_post('id', TRUE); ?><?php if ($query->num_rows() > 0): ?><?php foreach($query->result() as $row): ?>
<link rel="stylesheet" type="text/css" href="http://localhost/codeigniterapp/css/style.css" />
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="http://localhost/codeigniterapp/css/ie6.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css" />
<title><?=$row->title; ?></title>
<?php endforeach; ?>
<?php endif; ?></head>




