Skip to content

Instantly share code, notes, and snippets.

@fairlane57
Last active February 16, 2016 03:18
Show Gist options
  • Save fairlane57/5466240 to your computer and use it in GitHub Desktop.
Save fairlane57/5466240 to your computer and use it in GitHub Desktop.
Useful Concrete5 Snippets
# -------------------
# homepage URL
# -------------------
<?php echo DIR_REL; ?>
# -------------------
# Theme path
# -------------------
<?php echo $this->getThemePath(); ?>
# usage
<img src="<?php echo $this->getThemePath(); ?>/images/image.png" />
# -------------------------------------------
# Code Nav Block into theme (Autonav)
# -------------------------------------------
<?php
$bt = BlockType::getByHandle('autonav'); <- Blockname
$bt->controller->displayPages = 'top'; <- property
$bt->controller->orderBy = 'display_asc'; <- property
$bt->controller->displaySubPages = 'none'; <- property
$bt->render('view'); <- template to render block with
?>
# Then style the default autonav
.nav li{
display:inline-block;
list-style:none;
padding:5px 0px!important;
}
.nav li a{
color:#fff;
text-decoration:none;
}
.nav li.nav-selected a {
color:#2e66c4;
border-bottom:2px solid #2e66c4;
}
.nav li a:hover{
color:#2e66c4;
border-bottom:2px solid #2e66c4;
}
# -------------------------------------------
# Edit Mode Conditional
# -------------------------------------------
if($c->isEditMode()) {
//its editmode!
}
if(!$c->isEditMode()) {
//its not editmode!
}
<?php
global $c;
if(!$c->isEditMode()){
?>
<script type="text/javascript" src="<?php echo $this->getThemePath(); ?>/js/function-hero.js"></script>
<?php } //end of check of edit mode ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment