Sorun (kek kullanarak php) Blog uygulamasına intro metin sağlayan

1 Cevap php

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

Aşağıdaki index.ctp dosyasıdır

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

Benzer şekilde, ben de add.ctp, edit.ctp ve view.ctp özet alan eklemiş

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

1 Cevap

Zaten bir "özet" alan yoktu "mesaj" tablosunun bir sürümü var mı, sonra geri gitti ve ekledi? Eğer öyleyse, size modeli önbelleğini silmek gerekebilir.

rm -rf app/tmp/cache/models/cake_model_*