Skip to content

Commit

Permalink
#35 : Ajout de l'acces au CMS via TWIG {{ CMS.nomdevar }}
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanBigOne committed Mar 15, 2017
1 parent 3844f75 commit 4077214
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
20 changes: 20 additions & 0 deletions class/CmsListe.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ public function applyRules4GetBlock($sRef)
"value" => $sRef
]
]);
$this->addCriteres([
[
"field" => "date_deleted",
"compare" => "IS NULL",
"value" => ""
]
]);

}

public function applyRules4All()
{
$this->setAllFields();
$this->addCriteres([
[
"field" => "date_deleted",
"compare" => "IS NULL",
"value" => ""
]
]);

}

Expand Down
11 changes: 11 additions & 0 deletions services/App.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ public static function init()
$twig->addGlobal("urlPageEncoded", urlencode($oNavigate->getUrl()) );
$twig->addGlobal("urlSite", ConfigService::get("urlSite"));
$twig->addGlobal("urlSiteHTTP", str_replace("https://","http://",ConfigService::get("urlSite")));
$twig->addGlobal("urlSite", ConfigService::get("urlSite"));

//CMS
$oListeCms=new CmsListe();
$oListeCms->applyRules4All();
$aDatas=$oListeCms->getPage();
$aDataCms=array();
foreach($aDatas as $aData){
$aDataCms[$aData["ref"]]=$aData["content"];
}
$twig->addGlobal("CMS", $aDataCms);

if(file_exists( self::TWIG_TEMPLATE_DIR."/".$oNavigate->getTemplate()))
{
Expand Down
5 changes: 1 addition & 4 deletions templates/visitor/candidature/candidatures.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
<div class="container">
<div class="row">
<div class="col-xs-12 markdown jsEditCmsBlock" data-block-ref="homeadmin">
##Hello.
* This is markdown.
* It is fun
* Love it or leave it.
{{ CMS.homeadmin }}
</div>
<div class="row">
<div class="col-xs-12 text-center">
Expand Down

0 comments on commit 4077214

Please sign in to comment.