Следующий заголовок добавлен в мой index.ctp в CAKEPHP 2.XXX .... Как его удалить?удалить Заголовок по умолчанию: «CakePHP: быстрый ...» из моего «index.ctp»
здесь вы идете:
<div id="header">
<h1><a href="http://cakephp.org">CakePHP: the rapid development php framework</a></h1>
</div>
вот мой index.ctp файл
<h1>Blog posts</h1>
<p><?php echo $this->Html->link("Add Post", array('action' => 'add')); ?></p>
<table>
<tr>
<th>Id</th>
<th>Title</th>
<th>Action</th>
<th>Created</th>
</tr>
<!-- Here's where we loop through our $posts array, printing out post info -->
<?php foreach ($posts as $post): ?>
<tr>
<td><?php echo $post['Post']['id']; ?></td>
<td>
<?php
echo $this->Html->link(
$post['Post']['title'], array('action' => 'view', $post['Post']['id'])
);
?>
</td>
<td>
<?php
echo $this->Form->postLink(
'Delete', array('action' => 'delete', $post['Post']['id']), array('confirm' => 'Are you sure?')
);
?>
<?php
echo $this->Html->link(
'Edit', array('action' => 'edit', $post['Post']['id']), array('confirm' => 'EDIT ?')
);
?>
</td>
<td>
<?php echo $post['Post']['created']; ?>
</td>
</tr>
<?php endforeach; ?>
</table>
помочь мне плз ....
Я пытался добавить default.ctp в «приложение/layouts ", но мое приложение не работает ... оно показывает только default.ctp, но не мой index.ctp
следующий мой Cont файл ролика ....
<?php
class PostsController extends AppController {
public $helpers = array('Html', 'Form');
public function index() {
$this->set('posts', $this->Post->find('all'));
}
public function view($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
$post = $this->Post->findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
$this->set('post', $post);
}
public function add() {
if ($this->request->is('post')) {
$this->Post->create();
if ($this->Post->save($this->request->data)) {
// $this->Session->setFlash(__('Your post has been saved.'));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Unable to add your post.'));
}
}
public function edit($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
$post = $this->Post->findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
if ($this->request->is(array('post', 'put'))) {
$this->Post->id = $id;
if ($this->Post->save($this->request->data)) {
// $this->Session->setFlash(__('Your post has been updated.'));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Unable to update your post.'));
}
if (!$this->request->data) {
$this->request->data = $post;
}
}
public function delete($id) {
if ($this->request->is('get')) {
throw new MethodNotAllowedException();
}
if ($this->Post->delete($id)) {
//$this->Session->setFlash(__('The post with id: %s has been deleted.', h($id)) );
return $this->redirect(array('action' => 'index'));
}
}
}
?>
Добавить контроллер. похоже, что вы используете макет по умолчанию. вам нужно создать новый макет для заголовка –
@MoyedAnsari ... Это мой файл с контроллером ..... так какие должны быть возможные резоны .... –
у вас есть макет, отличный от по умолчанию? –