RSS Feed

More php / mySQL | html | css | js

     Notes: PHP / MYSQL | HTML | CSS | JS
free-php-scripts
free-joomla-extensions

Feb 17
2011

Codeigniter Blog

Posted 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.

<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>

Comments (0)add comment

Write comment

busy