"Design & Custom Template" no buttons work in this mode

Permalink
Hi!

I'm just playing around trying to understand concrete5 for all it's worth.
I have made my own template with bootstrap3.

When I add content, and go into the Design & Custom Template mode, none of the buttons work..

I'm hoping there just something I've missed! Anyway, thank you in advance!

View Replies: View Best Answer
Hypocrite replied on at Permalink Reply
Hypocrite
Do you have any add-ons installed?
gjermundnor replied on at Permalink Reply
Yes I have one for getting an imageblock to be responsive
gjermundnor replied on at Permalink Best Answer Reply
I solved my problem. I was loading both jquery and bootstrap more than once, because concrete5 does it as well as my template.

With this code in the page_theme.php file inside the PageTheme class, it solves the problem:

public function registerAssets() {
        $this->providesAsset('javascript', 'bootstrap/*');
        $this->providesAsset('css', 'bootstrap/*');
        $this->providesAsset('css', 'blocks/form');
        $this->providesAsset('css', 'core/frontend/*');
        $this->requireAsset('javascript', 'jquery');
    }
Hypocrite replied on at Permalink Reply
Hypocrite
Excellent. That was actually the same reason for me when one of my add-ons was loading jquery and bootstrap twice.
amberleaf replied on at Permalink Reply
Sorry to open an old thread but when you say to write this code in the page_theme.php file inside the PageTheme class, where is it and what exactly are you talking about? I'm using a custom bootstrap theme that i've brought into Concrete 5.7 and i have to either choose between my mobile navigation working or the 'design and custom template' editor working within the admin. This seems to be the only thread i can find that touches on the subject. Any pointers would be greatly appreciated.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@amberleaf

What folder (and its path) is your custom theme in?

The page_theme.php file stores information specific to your theme.

Example: page_theme.php that is part of the Elemental theme
concrete\themes\elemental\page_theme.php

Developer documentation on registering theme JavaScript and CSS.
https://www.concrete5.org/documentation/developers/5.7/designing-for...
amberleaf replied on at Permalink Reply
Thanks for the information. I didn't have a page_theme.php file in my custom theme so i created this file located in /application/themes/my_custom_theme/page_theme.php

I began to find the links to the developer docs on Concrete5 such as the link you provided. However, with not being a developer any references to javascript and php usually throw me a bit and i'm not sure what to place into the page_theme.php file. As i understand it, on my bootstrap html pages i have two links to .js files but this conflicts with Concrete 5. So the solution is to remove them and include them in the page_theme.php file. Only trouble is i haven't got a clue how, and the docs don't make any sense to me no matter how much i read them.

(like the constant mentions of using a Page Theme Class, is this like a css class or something? sorry for sounding so thick but this one issue is preventing me from using Concrete5 for future sites since they'd all be built up using Bootstrap. I'm completely new to Concrete 5.7 so i'm still figuring out the basics. Having said that, it does so far appear to be much better than other platforms such as Wordpress and MODx which i've used in the past).

I'll post any further progress i make on this topic.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@amberleaf

The PageTheme class is a PHP class used in Object-Oriented PHP.

Did you read this page and watch the video?
https://www.concrete5.org/documentation/developers/5.7/designing-for...

What files assets are you currently including in your theme that should be registered?

What folder is your theme in - application or packages? This is important for creating the namespace for your page_theme.php file.

Example: page_theme.php
- the theme is called "amberleaf"
- the theme is in application\themes
application\themes\amberleaf
- the page_theme.php in the "amberleaf" folder
application\themes\amberleaf\page_theme.php
<?php
namespace Application\Theme\Amberleaf;
class PageTheme extends \Concrete\Core\Page\Theme\Theme 
{
   public function registerAssets() 
  {
        $this->providesAsset('css', 'bootstrap/*');
        $this->providesAsset('javascript', 'bootstrap/*');
        $this->requireAsset('javascript', 'jquery');
        $this->requireAsset('javascript', 'picturefill');
        $this->requireAsset('javascript-conditional', 'html5-shiv');
        $this->requireAsset('javascript-conditional', 'respond');
   }
    protected $pThemeGridFrameworkHandle = 'bootstrap3';
}

this would require from concrete5:
- jQuery.js (cross-browser JavaScript library)
- Picturefill.js (fallback support for the <picture> element)
- HTML5Shiv.js (adds support for HTML5 elements in older browsers)
- Respond.js (adds support for media queries in older browsers)
you would provide concrete5:
- all concrete5 Bootstrap JavaScript and CSS assets
Bootstrap3 would be used as the grid framework

Assets included with concrete5
https://www.concrete5.org/documentation/developers/5.7/appendix/asse...
amberleaf replied on at Permalink Reply
Firstly, a super thanks for your patience and response! I've been studying the links, docs and info you supplied and found my first introduction to page_theme.php and the PageTheme class via the docs which explain how to add grid support (https://www.concrete5.org/documentation/developers/5.7/designing-for-concrete5/adding-grid-support-to-your-theme/enabling-grid-support-for-areas-and-layo/).

Between the above link and your own notes i'm better understanding the php code and the PageTheme class although i do think in all the wizardry and brilliance of the people who develop Concrete 5.7, this whole issue of theme files like javascript breaking the Concrete 5 UI from the get-go is a real mind bender trying to fix and figure out (especially for someone like myself who turns to Concrete 5 as a designer).

All in all i now have both my bootstrap menu / javascript working and it's not conflicting or breaking the Concrete5.7 UI which was my original problem..

Following your example, what did throw me was the way you had written the code-

<?php
namespace Application\Theme\Amberleaf;
class PageTheme extends \Concrete\Core\Page\Theme\Theme 
{
   public function registerAssets() {
        $this->providesAsset('css', 'bootstrap/*');
        $this->providesAsset('javascript', 'bootstrap/*');
        $this->requireAsset('javascript', 'jquery');
        $this->requireAsset('javascript', 'picturefill');
        $this->requireAsset('javascript-conditional', 'html5-shiv');
        $this->requireAsset('javascript-conditional', 'respond');
   }
    protected $pThemeGridFrameworkHandle = 'bootstrap3';
}


I guess the reason the above code didn't work for me is because firstly i created the page_theme.php file and it's content following the tutorial noted above for 'adding grid support' to my theme, and then when i added your code it crashed my site (again, down to my lack of php knowledge).. until i figured out to write it as follows-

<?php
namespace Application\Theme\mytheme;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme {
   public function registerAssets() {
        $this->providesAsset('css', 'bootstrap/*');
        $this->providesAsset('javascript', 'bootstrap/*');
        $this->requireAsset('javascript', 'jquery');
        $this->requireAsset('javascript', 'picturefill');
        $this->requireAsset('javascript-conditional', 'html5-shiv');
        $this->requireAsset('javascript-conditional', 'respond');
   }
   protected $pThemeGridFrameworkHandle = 'bootstrap3';
}


Also, at first it didn't work but then i un-commented out the two lines in my html that linked to the two javascript files for my Bootstrap 3 theme. So i presume that by adding those PageTheme classes what it's doing is allowing me to 'keep' those links in my theme to javascript without causing any conflicts with Concrete 5.7

I've only spent a relatively tiny amount of time trying out Concrete 5.7 for the first time and it does appear to be a serious bit of kit, can't believe i've not tried it before now. However, like i say, these code conflicts are challenging to get used to, considering how seamless and intuitive everything else seems to work.
MrKDilkington replied on at Permalink Reply
MrKDilkington
@amberleaf

I edited my last reply to be more explicit.

Registering your assets is designed to prevent code conflicts. Assets are used in blocks, themes, single pages, packages, and more. Registering assets allows concrete5 to manage the assets for you. Otherwise you might have situations where a theme and multiple blocks include the same assets. At best it creates more files to download, but very likely it breaks something.
MatyasBauer replied on at Permalink Reply
Hi,
I have the same issue you had before and I wonder if you can help me. I have an asset conflict in my template and I can't use design&custom template mode.

I add a file page_theme.php into my application/themes/basic folder with my template (named basic) with the code:

<?php
namespace Application\Theme\basic;
use Concrete\Core\Page\Theme\Theme;
class PageTheme extends Theme {
public function registerAssets() {
$this->providesAsset('css', 'bootstrap/*');
$this->providesAsset('javascript', 'bootstrap/*');
$this->requireAsset('javascript', 'jquery');
$this->requireAsset('javascript', 'picturefill');
$this->requireAsset('javascript-conditional', 'html5-shiv');
$this->requireAsset('javascript-conditional', 'respond');
}
protected $pThemeGridFrameworkHandle = 'bootstrap3';
}

but it does not resolve the problem. How did you manage to solve this problem? Many thanks for any reply.
amberleaf replied on at Permalink Reply
Reply is for another post