本文整理汇总了PHP中Site::scripts方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::scripts方法的具体用法?PHP Site::scripts怎么用?PHP Site::scripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::scripts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionContent
protected function actionContent($params)
{
if (!isset($params['slug'])) {
$params['slug'] = '';
}
$content = \GO\Site\Model\Content::model()->findBySlug($params['slug']);
if (!$content) {
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
echo $this->render('/site/404');
} else {
$this->setPageTitle($content->metaTitle);
if (!empty($content->meta_description)) {
\Site::scripts()->registerMetaTag($content->meta_description, 'description');
}
if (!empty($content->meta_keywords)) {
\Site::scripts()->registerMetaTag($content->meta_keywords, 'keywords');
}
// Check if the template is not empty
if (empty($content->template)) {
$defaultTemplate = \Site::config()->getDefaultTemplate();
if (!empty($defaultTemplate)) {
$content->template = $defaultTemplate;
}
}
echo $this->render($content->template, array('content' => $content));
}
}
示例2: render
/**
* Render an empty div where the uploader will eventualy be rendered after the javascript loads
* @return type
*/
public function render()
{
\Site::scripts()->registerScript('plupload#' . $this->id, $this->createjs(), \GO\Site\Components\Scripts::POS_END);
return '<div id="' . $this->id . '">Loading upload widget...</div>';
}
示例3: dateField
public function dateField($model, $attribute, $htmlAttributes = array(), $datePickerOptions = array())
{
$this->_nDateFields++;
$currentUser = \GO::user();
$dateFormatArr = array();
$goDateFormat = !empty($currentUser) ? $currentUser->date_format : \GO::config()->default_date_format;
$goDateSeparator = !empty($currentUser) ? $currentUser->date_separator : \GO::config()->default_date_separator;
for ($i = 0; $i < 3; $i++) {
if ($goDateFormat[$i] == 'Y') {
$dateFormatArr[] = 'yy';
} else {
$dateFormatArr[] = $goDateFormat[$i] . $goDateFormat[$i];
}
}
$datePickerOptionsString = '';
$allowedWeekdaysArray = '[0,1,2,3,4,5,6]';
foreach ($datePickerOptions as $name => $value) {
if ($name == 'allowedWeekDays') {
$allowedWeekdaysArray = json_encode($value);
} else {
$datePickerOptionsString .= ',' . $name . ': ' . var_export($value, true) . '';
}
}
\Site::scripts()->registerGapiScript('jquery');
\Site::scripts()->registerGapiScript('jquery-ui');
\Site::scripts()->registerCssFile('http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css');
\Site::scripts()->registerScript('datepicker' . $this->_nDateFields, '
$(function() {
$( "#datepicker' . $this->_nDateFields . '" ).datepicker({ dateFormat: "' . implode($goDateSeparator, $dateFormatArr) . '" ' . $datePickerOptionsString . '
// ,beforeShow:function(input) {
// $(input).css({
// "position": "relative",
// "z-index": 999999
// });
// }
});
});
');
$htmlAttributes['id'] = 'datepicker' . $this->_nDateFields;
return $this->_inputField('text', $model, $attribute, $htmlAttributes);
}
示例4: printContentRecursive
echo '<div class="col-md-12">';
}
?>
<?php
function printContentRecursive($content, $level = 1)
{
echo '<h' . $level . ' id="' . $content->baseslug . '">' . $content->title . '</h' . $level . '>';
echo '<div>' . $content->getHtml() . '</div>';
// echo '<div class="top-link"><a title="Jump to the top of the page" href="#top"><span class="glyphicon glyphicon-chevron-up"></span></a></div>';
foreach ($content->children() as $child) {
printContentRecursive($child, $level + 1);
}
}
printContentRecursive($content);
?>
</div>
</div>
<div id="top-link" data-spy="affix" data-offset-top="400">
<a title="Jump to the top of the page" href="#header">
<span class="glyphicon glyphicon-chevron-up"></span>
</a>
</div>
<?php
Site::scripts()->registerScript('scrollspy', "\$('body').scrollspy({ target: '.toc' });\$('body').scrollspy({ target: '#top-link' })");
示例5:
<?php
\Site::scripts()->registerCssFile(\Site::file('css/ticket.css'));
?>
<div class="external-ticket-page ticket">
<div class="wrapper">
<?php
if (\GO::user()) {
?>
<< <a id="back-to-overview-button" href="<?php
echo \Site::urlManager()->createUrl('tickets/externalpage/ticketlist');
?>
"><?php
echo \GO::t('ticketBackToList', 'defaultsite');
?>
</a>
<?php
}
?>
<h2><?php
echo \GO::t('ticket', 'defaultsite') . ' ' . $ticket->ticket_number;
?>
</h2>
<!-- <h3><?php
echo \GO::t('ticketContactInfo', 'defaultsite');
?>
</h3>
示例6: render
/**
* Render a view file with layout wrapped
*
* @param string $view name of the view to be rendered
* @param array $data data tp be extracted om PHP variables
* @param boolean $return return rendering result if true
* @return string the redering result if $return is true
*/
public function render($view, $data = null)
{
$output = $this->renderPartial($view, $data);
if (($layoutFile = $this->getLayoutFile($this->layout)) !== false) {
$output = $this->renderFile($layoutFile, array('content' => $output), true);
}
\Site::scripts()->render($output);
return $output;
}