本文整理汇总了PHP中ContentController::init方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentController::init方法的具体用法?PHP ContentController::init怎么用?PHP ContentController::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentController
的用法示例。
在下文中一共展示了ContentController::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
if (!$this->config()->service) {
$this->httpError(404);
}
$this->setService($this->config()->service);
$this->pageService = new StyleGuide\PageService($this);
// redirect to the first action route
if (!$this->request->param('Action')) {
$page = $this->pageService->getPages()->first();
$this->redirect($page->Link);
}
// if no template set on the action route then redirect to the first child
if (!$this->request->param('ChildAction') && !$this->pageService->getTemplate()) {
$page = $this->pageService->getActivePage();
if (isset($page->Children)) {
$childPage = $page->Children->first();
$this->redirect($childPage->Link);
}
}
// set the service
$this->setRequirements();
// load the fixture file
$this->loadFixture();
}
示例2: init
public function init()
{
parent::init();
// Import jquery and bootstrap js
Requirements::javascript($this->ThemeDir() . "/js/libs/jquery.min.js");
Requirements::javascript($this->ThemeDir() . "/js/libs/bootstrap.min.js");
}
示例3: init
public function init()
{
parent::init();
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::themedCSS('layout');
Requirements::themedCSS('comments');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
Requirements::themedCSS('slick');
if (!Cookie::get($StoryModeCookie)) {
Cookie::set($StoryModeCookie, 'Normal');
}
if (!Cookie::get($StorySizeCookie)) {
Cookie::set($StorySizeCookie, 'Normal');
}
// Increment page view counter
$pagecounter = DataObject::get_one("PageCounter", "PageID='{$this->ID}'");
if (!$pagecounter) {
$pagecounter = new PageCounter();
$pagecounter->PageID = $this->ID;
}
$pagecounter->Counter = $pagecounter->Counter + 1;
$pagecounter->write();
}
示例4: init
public function init()
{
parent::init();
Requirements::themedCSS('reset');
Requirements::themedCSS('layout');
Requirements::themedCSS('form');
Requirements::themedCSS('typography');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::css('mysite/css/demo.css');
Requirements::css('mysite/css/moduleSupport.css');
Requirements::customScript(<<<JS
(function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-84547-17', 'auto', { 'allowLinker': true });
ga('require', 'linker');
ga('linker:autoLink', [
\t'www.silverstripe.com',
\t'www.silverstripe.org',
\t'addons.silverstripe.org',
\t'api.silverstripe.org',
\t'docs.silverstripe.org',
\t'userhelp.silverstripe.org',
\t'demo.silverstripe.org'
]);
ga('send', 'pageview');
JS
);
}
示例5: init
public function init()
{
parent::init();
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
Requirements::css('themes/simple/css/homepage.css');
Requirements::customScript('
$("a.scroll-arrow").mousedown( function(e) {
e.preventDefault();
var container = $(this).parent().attr("id");
var direction = $(this).is("#scroll-right") ? "+=" : "-=";
var totalWidth = -$(".row__inner").width();
$(".row__inner .tile").each(function() {
totalWidth += $(this).outerWidth(true);
});
$("#"+ container + " .row__inner").animate({
scrollLeft: direction + Math.min(totalWidth, 3000)
},{
duration: 2500,
easing: "swing",
queue: false }
);
}).mouseup(function(e) {
$(".row__inner").stop();
});');
}
示例6: init
public function init()
{
parent::init();
// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work
}
示例7: init
public function init()
{
parent::init();
// You can include any CSS or JS required by your project here.
// See: http://doc.silverstripe.org/framework/en/reference/requirements
Requirements::css("https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css");
}
示例8: init
public function init()
{
parent::init();
// Concatenate CSS
Requirements::combine_files('style.css', array('mysite/css/layout.css', 'mysite/css/userstyles.css'));
// Concatenate JavaScript
Requirements::combine_files('scripts.js', array('mysite/javascript/lib/top-nav.js', 'mysite/javascript/vanilla.js'));
// Google Analytics
$config = SiteConfig::current_site_config();
$google = $config->GACode;
$gaJS = <<<JS
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o), m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', '{$google}', 'auto');
ga('send', 'pageview');
JS;
Requirements::customScript($gaJS);
}
示例9: init
public function init()
{
parent::init();
Requirements::themedCSS('reset');
Requirements::themedCSS('layout');
Requirements::themedCSS('form');
Requirements::themedCSS('typography');
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::css('mysite/css/demo.css');
Requirements::css('mysite/css/moduleSupport.css');
Requirements::customScript(<<<JS
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-84547-11']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
JS
);
}
示例10: init
function init() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
示例11: init
public function init()
{
parent::init();
$this->loadCSS();
$this->loadFonts();
$this->customJQueryScripts();
$this->loadJS();
}
示例12: init
public function init()
{
parent::init();
Requirements::javascript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js");
Requirements::javascript("pocket-watch/js/bootstrap.min.js");
Requirements::javascript("pocket-watch/js/jquery.mixitup.min.js");
Requirements::javascript("pocket-watch/js/call.mixitup.js");
}
示例13: init
public function init()
{
parent::init();
Requirements::block('bootstrap-forms/css/bootstrap.css');
Requirements::block('bootstrap-forms/javascript/bootstrap_forms.js');
Requirements::block('framework/thirdparty/jquery/jquery.js');
Requirements::block('userforms/css/UserForm.css');
}
示例14: init
function init()
{
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
Requirements::javascript('mysite/javascript/extjs.js');
Requirements::javascript('themes/belmarkhomes/javascript/Page.js');
}
示例15: init
public function init() {
parent::init();
// Note: you should use <% require %> tags inside your templates instead of putting Requirements calls here. However
// these are included so that our older themes still work
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}