Version 9 templates

I’ve trying to upgrade several of my sites and can not get any of the custom templates or custom css to work. I’ve put the custom templates in application/blocks and application/themes/{theme_name}/blocks with no luck…

v9 theme styling works totally differently to that in v8. Now you have to do that in the following way:

I’ve added more info to the Tutorial on how to override and style blocks. Here’s what I do:

Override and style blocks

  • copy original block view.php to application/themes/your_theme_name/blocks/templates
  • copy original block view.js to application/themes/build/assets/js and rename it, e.g. some_block.js
  • import block js into main.js
import "./some_block";
  • copy original block view.css to application/themes/build/assets/scss/blocks and rename it, e.g. _some_block.scss
  • import block scss into _common.scss
@import "blocks/some_block";
  • change view.php, some_block.js and _some_block.scss as you need
  • compile theme js and scss assets
  • upload application/themes/your_theme_name/blocks/templates/template_name/view.php, application/themes/your_theme_name/assets/js/main.js and application/themes/your_theme_name/assets/scss/presets/default/main.scss to your server

Before you go all the way down a difficult path, make sure your running concrete v9.0.2

Before that version, there was a bug where block assets view.js and view.css would not load.

If that’s your case then simply upgrade to 9.0.2

Ok …I’ve got a simple image that I want to center on the page. I’ve created a custom template with just a view.php file. I’ve placed it in application/themes/{theme_name}/blocks/templates. When I try to apply it, In block template there is nothing along with custom class. I’ve even gone so far as to add the css to custom css with no results.
What is wrong with this picture
And I am using 9.02

I’m guessing here, if you place a view.php into a blocks/some_block/templates folder, it simply overrides the existing template without overriding styling because no new template name is made. So in that case all existing block css will be used. That only allows you to rearrange stuff on the page without changed styling.

But if you make a new folder blocks/some_block/templates/new_template_name and put the view.php and your new view.css in there, then it should both override it after selecting in the block design menu AND override styling from the new view.css.

Yup, thats exactly what I’m trying to do… It worked in V5 and V8 with no problems. All I want to do is add “ccm-image-block img-responsive img-rounded center-block” to the image so that it will style it correctly

Ah, I see. You’re trying to override it in the theme/blocks. Doesn’t look like it’s working so. Just tried that in the application/blocks, the new template is added but the view.css is not. Looks like the only way to override styling of the core blocks is the “hard” way.

It seems your paths are wrong. The correct path would be

It seems you’re missing the block’s handle every time. SO for instance for the image block the handle would be “image”

@mnakalay , I’ve corrected the path error in my previous post when I typed, thank you for pointing that out, but the case is the same

I don’t know what the problem is on your side but it’s working just fine on mine.

I created a simple template called “My Template” for the image block. It contains 2 files view.php and view.css so it’s

The template is available when I add the image block and the custom CSS is loaded.

I’m on concrete 9.0.2

I would suggest you double-check your version and your template

oh and when I said you’re missing the block’s handle every time I was referring to @rdealmeida who seems to be making the same mistake

My fault, I forgot I was using my own theme, rather than Atomik. After switching back to Atomik the template took effect. So, yes, overriding in the application/blocks works.

Then moving the templates folder into my theme/blocks/block_handle and activating the theme also works.

In the last case, if overriding in the theme, will the view.css be added to the skin css or will it be minified anyhow?

I need more Coffee!! Thanks mnakalay… You were right… Can’t see the forest cause the trees were in the way… I must have looked at that path a thousand times and did not see it. should be “application\blocks\image\templates\my_template\view.php”
mine was “application\blocks\image\templates\view.php”
Thanks Again

I need more Coffee!! Thanks mnakalay