Site's home page.

Gets a list of all promoted contents, so themes may render them in their
front-page layout. The view-variable `contents` holds all promoted contents,
themes might render this contents using this variable.

@return void
496204
public function home()
    {
        $this->loadModel('Content.Contents');
        $contents = $this->Contents
            ->find('all')
            ->where([
                'Contents.promote' => 1,
                'Contents.status >' => 0,
                'Contents.language IN' => ['', null, I18n::locale()]
            ])
            ->order(['Contents.sticky' => 'DESC', 'Contents.created' => 'DESC'])
            ->limit((int)option('site_contents_home'));

        $this->set('contents', $contents);
        $this->viewMode('teaser');
    }
651059
public function renderHeadSection()
    {
        $result = array();
        /* <meta> теги */
        if (count($this->head['meta-http']))
        {
            foreach ($this->head['meta-http'] as $key => $value)
            {
                $result[] = '	<meta http-equiv="' . $key . '" content="' . $value . '" />';
            }
        }

        if (count($this->head['meta-tags']))
        {
            foreach ($this->head['meta-tags'] as $key => $value)
            {
                $result[] = '	<meta name="' . $key . '" content="' . $value . '" />';
            }
        }

        /* <link> */
        if (count($this->head['link']))
        {
            foreach ($this->head['link'] as $value)
            {
                $result[] = '	<link rel="' . $value['rel'] . '" href="' . $value['href'] . '" type="' .
                    $value['type'] . '"' . (isset($value['media']) ? ' media="' . $value['media'] . '"' : '') . ' />';
            }
        }

        /*
         * <script>
         */
        foreach ($this->head['jslibs'] as $script)
        {
            /** @var HtmlScriptElement $script */
            $result[] = $script->getHTML();
        }
        foreach ($this->head['scripts'] as $script)
        {
            /** @var HtmlScriptElement $script */
            $result[] = $script->getHTML();
        }

        /* <style> */
        if (count($this->head['style']))
        {
            foreach ($this->head['style'] as $value)
            {
                $result[] = '	<style type="text/css"' . (isset($value['media']) ? ' media="' .
                        $value['media'] . '"' : '') . '>' . "\n" . $value['content'] . "\n  </style>";
            }
        }

        $this->head['content'] = trim($this->head['content']);
        if (!empty($this->head['content']))
        {
            $result[] = $this->head['content'];
        }

        $result = implode("\n", $result);
        return $result;
    }
25751
public static function addHomePage()
    {
        // creates the home page of the site
        $db = Database::connection();

        $cParentID = 0;
        $handle = HOME_HANDLE;
        $uID = HOME_UID;

        $data = array(
            'name' => HOME_NAME,
            'handle' => $handle,
            'uID' => $uID,
            'cID' => HOME_CID,
        );
        $cobj = parent::createCollection($data);
        $cID = $cobj->getCollectionID();

        $v = array($cID, $cParentID, $uID, 'OVERRIDE', 1, 1, 0);
        $q = 'insert into Pages (cID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder) values (?, ?, ?, ?, ?, ?, ?)';
        $r = $db->prepare($q);
        $r->execute($v);
        $pc = static::getByID($cID, 'RECENT');

        return $pc;
    }
202604
public function hook_indexContent()
    {
        $this->addPageToSitemapIndex();

        $possibility = (int)GeneralUtility::getExtConf('sitemap_clearCachePossibility', 0);

        if ($possibility > 0) {
            $clearCacheChance = ceil(mt_rand(0, $possibility));
            if ($clearCacheChance == 1) {
                SitemapUtility::expire();
            }
        }
    }
875867
public function display() {
		$path = func_get_args();

		$count = count($path);
		if (!$count) {
			return $this->redirect('/');
		}
		$page = $subpage = $title_for_layout = null;
        if (!empty($path[0])) {
			$page = $path[0];
		}
		if (!empty($path[1])) {
			$subpage = $path[1];
		}
		if (!empty($path[$count - 1])) {
			$title_for_layout = Inflector::humanize($path[$count - 1]);
		}
        $this->set(compact('page', 'subpage', 'title_for_layout'));
		try {

			$this->render(implode('/', $path));
		} catch (MissingViewException $e) {
			if (Configure::read('debug')) {
				throw $e;
			}
			throw new NotFoundException();
		}
	}
783972
public function All() {
      // Setup head.
      $this->Menu->HighlightRoute('/discussions');
      if (!$this->Title()) {
         $Title = C('Garden.HomepageTitle');
         if ($Title)
            $this->Title($Title, '');
         else
            $this->Title(T('All Categories'));
      }
      Gdn_Theme::Section('CategoryList');
            
      $this->Description(C('Garden.Description', NULL));
      
      $this->SetData('Breadcrumbs', CategoryModel::GetAncestors(GetValue('CategoryID', $this->Data('Category'))));
     
      // Set the category follow toggle before we load category data so that it affects the category query appropriately.
      $CategoryFollowToggleModule = new CategoryFollowToggleModule($this);
      $CategoryFollowToggleModule->SetToggle();
      
      // Get category data
      $this->CategoryModel->Watching = !Gdn::Session()->GetPreference('ShowAllCategories');
      
      $Categories = $this->CategoryModel->GetFull()->ResultArray();
      $this->SetData('Categories', $Categories);
      
      // Add modules
      $this->AddModule('NewDiscussionModule');
      $this->AddModule('DiscussionFilterModule');
      $this->AddModule('BookmarkedModule');
      $this->AddModule($CategoryFollowToggleModule);

      $this->CanonicalUrl(Url('/categories', TRUE));
      
      $Location = $this->FetchViewLocation('helper_functions', 'categories', FALSE, FALSE);
      if ($Location)
         include_once $Location;
      $this->Render();
   }
766749
public function content()
    {
        $arguments = func_get_args();
        $count = count($arguments);

        if ($count > 0) {
            $this->setText($arguments[0]);
        }

        if ($count > 1) {
            if (is_bool($arguments[1])) {
                $this->setMarkdown($arguments[1]);

                if ($count > 2) {
                    $this->setNotification($arguments[2]);
                }
            } else {
                call_user_func_array([$this, 'addAttachment'], array_slice($arguments, 1));
            }
        }

        return $this;
    }
526292
public function all()
    {
        $events = $this->repository->published();

        if (empty($events)) {
            abort(404);
        }

        return view('cms-frontend::events.all')->with('events', $events);
    }
1189599
public function showModuleContent()
    {
        $templates = array();
        foreach ($this->configuration['templates'] as $template) {
            $templates[] = array(
                'name'    => $template,
                'content' => str_replace(array("\n", "\r", "\t"), "", $this->getTemplateContent("templates/$template")),
            );
        }

        echo $this->getTemplateContent('content', array(
            'currentStep' => $this->getCurrentStep(),
            'totalSteps'  => $this->getTotalSteps(),
            'percent_real' => ($this->getCurrentStep() / $this->getTotalSteps()) * 100,
            'percent_rounded' => round(($this->getCurrentStep() / $this->getTotalSteps())*100),
            'isShutDown'  => $this->isShutDown(),
            'steps'       => $this->configuration['steps'],
            'jsonSteps'   => json_encode($this->configuration['steps']),
            'templates'   => $templates,
        ));
    }
1303544
public function index()
    {
        $this->loadModel('Content.Contents');
        $this->Contents->CreatedBy->fieldable(false);
        $this->Contents->ModifiedBy->fieldable(false);
        $contents = $this->Contents
            ->find('all', ['fieldable' => false])
            ->contain(['ContentTypes', 'CreatedBy', 'ModifiedBy']);

        if (!empty($this->request->query['filter']) &&
            $contents instanceof Query
        ) {
            $this->Contents->search($this->request->query['filter'], $contents);
        }

        $this->title(__d('content', 'Contents List'));
        $this->set('contents', $this->paginate($contents));
        $this->Breadcrumb->push('/admin/content/manage');
    }
1076480
public function setPageContent()
	{
		$content = "---\n";
		$content .= "type: ". $this->properties['type'] . "\n";
		$content .= "layout: " . $this->properties['layout'] . "\n";
		$content .= "title: " . $this->properties['title'] . "\n";
		$content .= "---\n";
		$content .= $this->properties['body'];

		return $content;
	}
1262709
private function _setContentFromFile() {
		
		// empty original template content
		$this->setContent('');
		
		// check for template file and load it
		if ($filename = $this->getTemplate()) {
			if (file_exists($filename)) {
				$content = trim(file_get_contents($this->_filename));
				$this->setContent($content);
			}
		}
	}
235417
public function all()
    {
        $faqs = $this->repository->published();

        if (empty($faqs)) {
            abort(404);
        }

        return view('cms-frontend::faqs.all')->with('faqs', $faqs);
    }
553311
protected function renderContent() {      
        ?>                
        <div id="maj-sosa-list-page" class="center">
			<h2><?php echo $this->data->get('title'); ?></h2>
			
			<?php  if($this->data->get('is_setup')) { 
			    $selectedgen = $this->data->get('generation');
			    $this->renderSosaHeader();
			    if($this->data->get('has_sosa') ) {
			         if($selectedgen > 0) {
			        ?>
			<div id="sosalist-tabs">
				<ul>
					<li><a href="#sosalist-indi"><?php echo I18N::translate('Individuals'); ?></a></li>
					<li><a href="#sosalist-fam"><?php echo I18N::translate('Families'); ?></a></li>
				</ul>
				
				<div id="sosalist-indi">
					<div id="loading-indi" class="loading-image">&nbsp;</div>
					<div id="sosalist-indi-data" class="center"></div>
				</div>

				<div id="sosalist-fam">
					<div id="loading-fam" class="loading-image">&nbsp;</div>
					<div id="sosalist-fam-data"></div>
				</div>
			</div>
			<?php        } else { ?>
			<p class="warning"><?php echo I18N::translate('No ancestor has been found for generation %d', $selectedgen); ?></p>
			<?php    }
			    }
			} else { ?>
			<p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/>
				<ul>
					<li><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></li>
					<li><?php echo I18N::translate('The Sosa ancestors have not been computed yet.'); ?></li>
				</ul>
			</p>
			<?php } ?>
		</div> 
		<?php 
    }
1035394
protected function renderContent()
    {
        foreach ($this->httpEquivs as $name => $content)
            echo CHtml::metaTag($content, null, $name);

        if ($this->_title !== null)
            echo CHtml::tag('title', array(), is_array($this->_title) ? implode($this->titleSeparator, $this->_title) : $this->_title);

        if ($this->_description !== null)
            echo CHtml::metaTag($this->_description, 'description');

        if ($this->_keywords !== null)
            echo CHtml::metaTag($this->_keywords, 'keywords');

        foreach ($this->_properties as $name => $content)
            echo CHtml::tag('meta', array('property' => $name, 'content' => $content));

        if ($this->_canonical !== null)
            echo CHtml::linkTag('canonical', null, $this->_canonical);
    }
1292048
public function content()
    {
        if ($this->app->getMatchRoute()) {
            $actionName = strtolower(preg_replace('/(?<=\d)(?=[A-Za-z])|(?<=[A-Za-z])(?=\d)|(?<=[a-z])(?=[A-Z])/', '-', $this->app->getActionName()));

            $fileArray = [
                strtolower($this->app->getModuleName()),
                str_replace('controller', '', strtolower($this->app->getControllerName())),
                $actionName . '.phtml'
            ];

            $file = implode('/', $fileArray);
        } else {
            $viewManager = $this->config->get('view_manager');
            $file = $viewManager['template_map']['error/404'];
        }

        $this->render($file);
    }
864467
protected function _toHtml()
    {
        if (!$this->getOptions()) {
            $cmsPages = $this->cmsPageCollection->addStoreFilter($this->getStoreFromContext());
            foreach ($cmsPages as $cmsPage) {
                /** @var \Magento\Cms\Model\Page $cmsPage */
                $this->addOption($cmsPage->getId(), $cmsPage->getTitle());
            }
        }

        return parent::_toHtml();
    }