Add block to custom page template?
Permalink
Hi
I have created an new page template for blog entries. And it work fine.
I would like to add some blocks to it, to make it easy to create new blog posts.
This is what I have so far.
How do I set the Page Title in the banner area of my theme - should I copy the header content and edit that to my needs?
How do I add page attributes like publish date formatted like: "l dS F Y"?
Topic list and tag list would also be nice...
At some point I would also like to add some affiliate ads. Guessing that is also best to do from the page template?
Thanks
I have created an new page template for blog entries. And it work fine.
I would like to add some blocks to it, to make it easy to create new blog posts.
This is what I have so far.
<?php defined('C5_EXECUTE') or die("Access Denied."); $this->inc('elements/header.php'); ?> <div id="innerwrapper"> <div class="container"> <div class="row"> <div class="col-md-12"> <?php $a = new GlobalArea('Breadcrumb Trail'); $a->display(); ?> </div> </div> <div class="row"> <div class="col-md-8"> <?php
Viewing 15 lines of 29 lines. View entire code block.
How do I set the Page Title in the banner area of my theme - should I copy the header content and edit that to my needs?
How do I add page attributes like publish date formatted like: "l dS F Y"?
Topic list and tag list would also be nice...
At some point I would also like to add some affiliate ads. Guessing that is also best to do from the page template?
Thanks
Thank you Steevb
The Page Title works.
Is there a way to get the title into the banner area - so the user can edit the Page Title block if needed?
This is how the banner is set in the Brimstone theme:
This outputs the Title right after the Banner area.
I would like to have it inside if possible.
The date gives this error:
"An unexpected error occurred.
Call to a member function formatDate() on null"
Sorry for all the questions - this is my first time messing around with concrete5 code.
Thank you for all your help.
The Page Title works.
Is there a way to get the title into the banner area - so the user can edit the Page Title block if needed?
This is how the banner is set in the Brimstone theme:
<div data-parallax="scroll" data-speed="0.4" data-bleed="10" data-image-src="<?php $banner = $c->getAttribute('banner'); $banner ? ($banner = $banner->getVersion()->getRelativePath()) : $banner; echo ($banner ? $banner : $this->getThemePath()."/img/background-brimstone-header.jpg"); ?>" id="banner" style="<?php $hide_banner = $c->getAttribute('hide_banner'); if($hide_banner){ echo "display:none"; } ?>"> <?php $a = new Area('Banner'); $a->enableGridContainer(); $a->display($c);
Viewing 15 lines of 18 lines. View entire code block.
This outputs the Title right after the Banner area.
I would like to have it inside if possible.
The date gives this error:
"An unexpected error occurred.
Call to a member function formatDate() on null"
Sorry for all the questions - this is my first time messing around with concrete5 code.
Thank you for all your help.
Your going to have to edit header.php for page title and the 'brimstone_title' template.
In header.php remove: replace with
In 'blocks/templates/brimstone_title/view.php' replace
with
In header.php remove:
<?php $a = new Area('Banner'); $a->enableGridContainer(); $a->display($c); ?>
<h1><?php echo $c->getCollectionName();?></h1>
In 'blocks/templates/brimstone_title/view.php' replace
<?php print $date; ?>
with
Thank you
I got your first date suggestion to work by adding this to the top of my template.
Is there a list of the code snippet for every block?
I would like to add Tags and a Topic List to my template to.
Thanks
Brian
I got your first date suggestion to work by adding this to the top of my template.
$dh = Core::make('helper/date'); /* @var $dh \Concrete\Core\Localization\Service\Date */ $date = $dh->formatDateTime($c->getCollectionDatePublic(), true);
Is there a list of the code snippet for every block?
I would like to add Tags and a Topic List to my template to.
Thanks
Brian
I got the Tags working with this:
http://www.concrete5.org/documentation/developers/5.7/working-with-...
Except for the link on the tags isn't working.
This results in links like this: /tag/watch?cID=
Is there a similar page for all blocks.... or just the Topic list... that would be great.
Brian
http://www.concrete5.org/documentation/developers/5.7/working-with-...
Except for the link on the tags isn't working.
$c = Page::getByID('/topics');
This results in links like this: /tag/watch?cID=
Is there a similar page for all blocks.... or just the Topic list... that would be great.
Brian
Date could be: