3 Ergebnisse für 'Yii'

Eingestellt 14. Mai 2014

Overview

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions. While Markdown's syntax has been influenced by several existing text-to-HTML filters -- including Setext, atx, Textile, reStructuredText, Grutatext, and EtText -- the single biggest source of inspiration for Markdown's syntax is the format of plain text email.

To this end, Markdown's syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you've ever used email.

Eingestellt 20. April 2014 · Aktualisiert 3. Mai 2014

Edit controllers/SiteController.php and add the following lines:

public function actionRss() {
	$posts=Post::model()->findAll(array(
		'order'=>'create_time DESC',
		'condition'=>'status='.Post::STATUS_PUBLISHED,
		'limit'=>20,
	));

	header('Content-Type: application/xml');
	$this->renderPartial('rss', array('posts'=>$posts));
}
Eingestellt 22. April 2014

Edit controllers/PostController.php and add this to the function actionIndex:

if(isset($_GET['search']))
	$criteria->addSearchCondition('title',$_GET['search'], true, 'AND');
	$criteria->addSearchCondition('content',$_GET['search'], true, 'OR');

Create components/Search.php with the following content:

<?php
Yii::import('zii.widgets.CPortlet');

class Search extends CPortlet
{
	public $title='Search';

	protected function renderContent()
	{
		echo CHtml::form(Yii::app()->createUrl('post/index'), 'get');
		echo CHtml::textField('search', $_GET['search'],
			array('placeholder'=>'keyword...', 'size'=>20));
		echo CHtml::submitButton('OK');
		echo CHtml::endForm();
	}
}

Now add this line to views/layouts/column2.php and you are all set!

<?php $this->widget('Search'); ?>
Seite 1 von 1