Class CBaseController
CBaseController is the base class for CController
and CWidget
.
It provides the common functionalities shared by controllers who need to render views.
CBaseController also implements the support for the following features:- CClipWidget Clips : a clip is a piece of captured output that can be inserted elsewhere.
- CWidget Widgets : a widget is a self-contained sub-controller with its own view and model.
- COutputCache Fragment cache : fragment cache selectively caches a portion of the output.
To use a widget in a view, use the following in the view:
$this->widget('path.to.widgetClass',array('property1'=>'value1',...));
or
$this->beginWidget('path.to.widgetClass',array('property1'=>'value1',...)); // ... display other contents here $this->endWidget();
To create a clip, use the following:
$this->beginClip('clipID'); // ... display the clip contents $this->endClip();
Then, in a different view or place, the captured clip can be inserted as:
echo $this->clips['clipID'];
Note that $this in the code above refers to current controller so, for example, if you need to access clip from a widget where $this refers to widget itself you need to do it the following way:
echo $this->getController()->clips['clipID'];
To use fragment cache, do as follows,
if($this->beginCache('cacheID',array('property1'=>'value1',...)) { // ... display the content to be cached here $this->endCache(); }
- CComponent
- CBaseController
Indirect known subclasses
AccountsController, AccountsGridViewProfileWidget, Api2Controller, MessageBox, MobileActiveForm, MobileActivityFeedListView, MobileCaptcha, MobileController, MobileFormLayoutRenderer, MobileLayoutRenderer, MobileRecordIndexPager, MobileTopicsPager, MobileViewLayoutRenderer, ApiController, ModelFileUploader, MultiTypeAutocomplete, NewWebLeadsGridViewProfileWidget, NoteActiveForm, NoteBox, NotificationsController, OnlineUsers, OpportunitiesController, OpportunitiesGridViewProfileWidget, Panel, Attachments, ProductsController, ProfileController, ProfileDashboardManager, ProfileGridViewWidget, ProfileInfo, ProfileLayoutEditor, ProfilesGridViewProfileWidget, Publisher, PublisherActionTab, PublisherCalendarEventTab, BugReportsController, PublisherCallTab, PublisherCommentTab, PublisherEventTab, PublisherSmallCalendarEventTab, PublisherTab, PublisherTimeTab, PublisherWidget, QuickContact, QuotesController, QuotesGridViewProfileWidget, CActiveForm, QuotesWidget, RecentItems, RecordAliasesWidget, RecordIndexListView, RecordView, RecordViewLayoutManager, RecordViewWidgetManager, RelationshipsController, Reminders, SearchController, CalendarController, ServicesController, ServicesGridViewProfileWidget, ServiceWebFormDesigner, SiteController, SmallCalendar, SocialForm, SortableWidget, SortableWidgetManager, SortableWidgets, StudioController, CalendarEventActiveForm, TagCloud, TemplatesController, TemplatesGridViewProfileWidget, TimeActiveForm, TimeZone, TopContacts, TopicsController, TopicsListView, TopSites, TransactionalViewWidget, CallActiveForm, TwitterFeed, TwitterFeedWidget, TwoColumnSortableWidgetManager, UsersChartProfileWidget, UsersController, WebActivityWidget, WebFormDesigner, WebLeadFormDesigner, WorkflowController, WorkflowStageDetailsWidget, CallsWidget, X2ActiveForm, X2ActiveGridView, X2ActiveGridViewForSortableWidgets, x2base, X2ConditionList, X2Controller, X2GridView, X2GridViewBase, X2GridViewForSortableWidgets, X2GridViewGeneric, CBaseListView, X2LeadsController, X2LeadsGridViewProfileWidget, X2ListView, X2ModelConversionWidget, X2PillBox, X2ProgressBar, X2StarRating, X2Widget, X2WidgetList, ActionActiveForm, CBasePager, CBreadcrumbs, CCaptcha, CClipWidget, CContentDecorator, CDetailView, CExtController, CFilterWidget, CFlexWidget, CGridView, ActionActiveFormBase, ChartWidget, ChatBox, CHtmlPurifier, CInputWidget, CJuiAccordion, CJuiAutoComplete, CJuiButton, CJuiDatePicker, CJuiDialog, CJuiDraggable, ActionMenu, CJuiDroppable, CJuiInputWidget, CJuiProgressBar, CJuiResizable, CJuiSelectable, CJuiSlider, CJuiSliderInput, CJuiSortable, CJuiTabs, CJuiWidget, ActionsController, CLinkPager, CListPager, CListView, CMarkdown, CMaskedTextField, CMenu, CMultiFileUpload, CommentsWidget, ContactMapInlineTags, ContactsController, ActionsGridViewProfileWidget, ContactsGridViewProfileWidget, COutputCache, COutputProcessor, CPortlet, CronForm, CStarRating, CTabView, CTextHighlighter, CTreeView, DateRangeInputsWidget, ActionsWidget, DetailView, DocsController, DocsGridViewProfileWidget, DocViewer, DocViewerProfileWidget, EmailProgressControl, EmailsWidget, EventActiveForm, EventsChartProfileWidget, EventsWidget, ActiveDateRangeInput, FileUploader, FormView, GridViewWidget, GroupsController, History, IframeWidget, InlineActionForm, InlineEmailForm, InlineQuotes, InlineRelationshipsGridView, AdminController, InlineRelationshipsWidget, InlineTagsWidget, LeftWidget, LoggedTimeWidget, MarketingController, MarketingGridViewProfileWidget, MediaBox, MediaController, MediaSelector, MenuListPackage: system\web
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/CBaseController.php
abstract public
string
|
#
getViewFile( string $viewName )
Returns the view script file according to the specified view name. This method must be implemented by child classes. |
public
string
|
|
public
string
|
#
renderInternal( string $_viewFile_, array $_data_ = null, boolean $_return_ = false )
Renders a view file. This method includes the view file as a PHP script and captures the display result if required. |
public
|
#
createWidget( string $className, array $properties = array() )
Creates a widget and initializes it. This method first creates the specified
widget instance. It then configures the widget's properties with the given
initial values. At the end it calls |
public
mixed
|
|
public
|
#
beginWidget( string $className, array $properties = array() )
Creates a widget and executes it. This method is similar to |
public
|
#
endWidget( string $id = '' )
Ends the execution of the named widget. This method is used together with
|
public
|
#
beginClip( string $id, array $properties = array() )
Begins recording a clip. This method is a shortcut to beginning |
public
|
|
public
boolean
|
#
beginCache( string $id, array $properties = array() )
Begins fragment caching. This method will display cached content if it is
availabe. If not, it will start caching and would expect a if($this->beginCache($id)) { // ...generate content here $this->endCache(); } |
public
|
|
public
|
#
beginContent( mixed $view = null, array $data = array() )
Begins the rendering of content that is to be decorated by the specified view. |
public
|