The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Fixed main page controller function

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
master
Polonkai Gergely 11 years ago
parent 95152ca62b
commit 44c555bcb7
  1. 12
      src/KekRozsak/FrontBundle/Controller/DefaultController.php
  2. 27
      src/KekRozsak/FrontBundle/Entity/Article.php
  3. 4
      src/KekRozsak/FrontBundle/Resources/config/doctrine/Article.orm.yml
  4. 12
      src/KekRozsak/FrontBundle/Resources/views/Default/front_template.html.twig

@ -6,10 +6,22 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function homepageAction()
{
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('main_page' => 1), true, array('created_at', 'DESC'), 1);
if (!$mainPageArticle)
throw $this->createNotFoundException('A keresett cikk nem létezik!');
return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug()));
}
public function articleAction($articleSlug)
{
$article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($articleSlug);
if (!$article)
throw $this->createNotFoundException('A keresett cikk nem létezik!');
return $this->render('KekRozsakFrontBundle:Default:article.html.twig', array(
'article' => $article
));

@ -267,4 +267,31 @@ class Article
{
return $this->updated_by;
}
/**
* @var boolean $main_page
*/
private $main_page;
/**
* Set main_page
*
* @param boolean $mainPage
* @return Article
*/
public function setMainPage($mainPage)
{
$this->main_page = $mainPage;
return $this;
}
/**
* Get main_page
*
* @return boolean
*/
public function getMainPage()
{
return $this->main_page;
}
}

@ -29,6 +29,10 @@ KekRozsak\FrontBundle\Entity\Article:
update_reason:
type: text
nullable: true
main_page:
type: boolean
nullable: true
default: false
manyToOne:
created_by:
targetEntity: User

@ -8,18 +8,18 @@
<div id="wrapper">
<div id="menu">
<ul>
<li><a href="">Főoldal - Aktuális</a></li>
<li><a href="">Rólunk</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_homepage') }}">Főoldal - Aktuális</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'rolunk' }) }}">Rólunk</a></li>
<li><a href="">Fórum</a></li>
<li><a href="">Mágiáról röviden</a></li>
<li><a href="">Rendek</a></li>
<li><a href="">A régiek</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'magiarol-roviden' }) }}">Mágiáról röviden</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'rendek' }) }}">Rendek</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_article', { articleSlug: 'a-regiek' }) }}">A régiek</a></li>
<li><a href="">Archívum</a></li>
<li><a href="">Ajánlott oldalak</a></li>
</ul>
</div>
<div id="header">
<h1><img src="{{ asset('images/kek_rozsak_felirat.jpg') }}" alt="Kék Rózsák" /></h1>
<h1><a href="{{ path('KekRozsakFrontBundle_homepage') }}"><img src="{{ asset('images/kek_rozsak_felirat.jpg') }}" alt="Kék Rózsák" /></a></h1>
<h2><img src="{{ asset('images/okkultista_kor_felirat.jpg') }}" alt="A Kék Rózsa okkultista kör honlapja" /></h2>
</div>
<div id="content-wrapper">

Loading…
Cancel
Save