Auto added block on new pages (blocks defined directly into theme)

Permalink
I am new to Concrete5 and I really want to give it a shot. It has a lot of potential.

But I have a problem - I would like to "auto add" a block when creating a new page.

Is there any way I can write some PHP code directly into my theme so that a block with a certain block type is created? Or is it possible in any other way?

(Why I would want to do this is becouse I want to add for example a logo that appears on every page, but I don't want my user to be able to edit this block)

 
adajad replied on at Permalink Reply
adajad
Hi there,

The correct way to go would be to create different page types within C5 and set your default blocks in there.

More information can be found here:http://www.concrete5.org/documentation/general-topics/page-types/...

Edit: The logo can be a hard coded <img /> in your template.

Edit2: I'm in GBG btw, so feel free to pm me if you want help in swedish, and I will be happy to help you as much as I can.
Hypocrite replied on at Permalink Reply
Hypocrite
You can do this in the following way:

1. Go to your Dashboard and into a Scrapbook.
2. Create a new block and give it a name, for example "Image".
3. Open the template file where you want to add the block and add the following code into the template:
<?php
$block = Block::getByName('Image'); 
$block->display();
?>