<?php include 'header.php'; $item = ItemMapper::instance()->find($_GET['id']); ?> <?php $feed_helper = new FeedHelper(); ?> <?php echo $feed_helper->link($item->feed()); ?> <h2><?php echo $item->title(); ?> </h2> <?php echo $item->body(); include 'footer.php';
public function actionFeed($type = 'rss') { header('Content-Type: application/rss+xml'); if (Yii::app()->request->getQuery('model') !== null) { $modelClass = 'Model' . ucfirst(Yii::app()->request->getQuery('model')); ContentUnit::loadUnits(); if (!FeedHelper::isFeedPresent($modelClass, Yii::app()->request->getQuery('id') === null)) { throw new CHttpException(404, Yii::t('cms', 'The requested page does not exist.')); } // Фид определенного раздела if (Yii::app()->request->getQuery('id') !== null && ($content = call_user_func(array($modelClass, 'model'))->findByPk(intval(Yii::app()->request->getQuery('id'))))) { FeedHelper::renderFeed($type, $content); // Фид всех записей этого типа } else { FeedHelper::renderFeed($type, $modelClass); } // Общий фид } else { FeedHelper::renderFeed($type); } }
<?php include 'header.php'; $feeds = FeedMapper::instance()->find_all(); $feed_helper = new FeedHelper(); ?> <table> <tr><th>id</th><th>title</th><th>feed url</th><th>time to live</th> <tr> <?php foreach ($feeds as $feed) { ?> <tr> <td><?php echo $feed->id(); ?> </td> <td><?php echo $feed_helper->link($feed); ?> </td> <td><?php echo $feed->feed_url(); ?> </td> <td><?php echo $feed->time_to_live();