Background I am developing my blog application in Cake PHP. I aim to provide an intro text for each post on the home page. The user can then click on the "Read more" link to read the entire post. Following is my posts table.
$query = 'CREATE TABLE posts (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(255) DEFAULT NULL,
date DATETIME DEFAULT NULL,
summary TEXT,
content TEXT,
user_id INT(11) DEFAULT NULL,
PRIMARY KEY(id))
ENGINE=MyISAM';
Following is the index.ctp file
<?php foreach($posts as $post): ?>
<div class="story">
<?php echo $html->link('<h1>'.$post['Post']['name'].'</h1>', '/posts/view/'.$post['Post']['id'],null,null,false); ?>
<p>Posted <?php echo date('M jS Y, g:i a', strtotime($post['Post']['date'])); ?> </p>
<p><b>By: <?php echo $post['User']['firstname']; ?> <?php echo $post['User']['lastname']; ?></b></p>
<br/>
<p><?php echo $post['Post']['summary']; ?><?php echo $html->link('<h2>Read More</h2>', '/posts/view/'.$post['Post']['id'],null,null,false); ?></p>
</div>
<?php endforeach; ?>
Similarly,I have also added the summary field in add.ctp, edit.ctp and view.ctp
Problem Now the problem is that when I try to create a new post, the summary field is not getting committed to the database. There is no problem with other fields. Moreover, even when I manually add text into the summary field from phpMyAdmin, I still can't view it in my home page. No errors have been reported. What am I missing??