Issue adding image block to template pages
I'm using a custom theme based on a copy of the elemental theme. I want an image block and a title block to show up on every page with the exception of the home page, which has a slider block. I want to place these blocks into the "Page Header" area.
So if someone were to create a new page, there would automatically be a title block and image block, and they would just need to replace the image. The formatting of the image block would then be the same on every page.
For reference, I'm including a couple screenshots of the joomla website I'm trying to convert to concrete5.
I've looked at this page:
and started to try and add a block into left_sidebar.php, but I didn't know what I was doing and just got an error.
I then found this page:
and thought that looked like the easiest solution, just add the block in the default! But when I try what is suggested:
Dashboard->Pages$Themes->Page Types->Empty Page->Output->Left Sidebar->Edit Defaults, I get the dreaded "403 Error, you are not allowed to access this page"
Even though I should be an administrator, I went ahead and logged out as my account and logged in as the administrator, same result.
So my questions are:
- which is the right approach for what I want to do?
- if the first approach (add block to left_sidebar.php in my theme/elements/ directory), how do you add a block within an area?
- if the second approach (edit what the defaults are for a given page), why am I getting the error and how do I fix it?
Thanks for the help,
I think this is a typical case for a stack and a global area. A Stack is a Block too, but its reusable. That means you create a Stack like any other Block (in your case an Image Block). To do this, follow this guide for creating a Stack:
Then you'll need to go inside the code to understand what it's all about Global Areas (You don't need really, but its interesting to see). I'll take the example of the Elemental Theme. A normal Area is shown like this:
// /application/themes/elemental/default.php <?php $a = new Area('Main'); $a->enableGridContainer(); //This is optional $a->display($c); ?>
And a Global Area is shown like this:
// /application/themes/elemental/elements/header.php <?php $a = new GlobalArea('Header Site Title'); $a->display(); ?>
You see the rendering when editing a Page. When hovering a block, a title is shown in the lower left corner. If its a Global Area it says "Sitewide Header Site Title" or "Sitewide Header Navigation" and so on.
If its not a Global Area then the title doesn't show a "Sitewide". So if you'd like to have another Global Area, just place the above code at the right place and give it a title:
<?php $a = new GlobalArea('My first Global Area'); $a->display($c); ?>
The important thing is before you do any changes to the Elemental Theme, copy the whole elemntal folder from
Hope this helps. If you have any further question, don't hesitate
I tried adding a stack that contained an image block and a title block. I left the image blank, thinking that I could replace the image on each page I added the stack to. But that isn't the case, I see now Stacks are used when you don't want the content to change.
My use case is that I do want the content (image) to change on each page, I just want the formatting of the image block to be the same and for it to automatically be included whenever you create a new page (as a reminder that an image needs to be added).
I did get the new global area to work.
Sorry for having missunderstood the Stack part.
As far as I know, that global Area should then appear on all newly created pages too.
As it concerns the permissions, I don't think that's the problem, because if folder permissions aren't set the right way, c5 would not be installed.
Do you have all caches turned off? This should be set when developing or editing a new site. Go to System & Settings -> Optimization -> Cache & Speed Settings and turn all caches off until you go live.
Also, you should maybe empty cache too, after all your trials.
Let me know if that helps.
As far as I can tell, you cannot change the image in a global area without it being applied to all pages that have that global area. So this is not a fix for what I want, which is just to have a default image "holder" on every page.
Thank you for your help, I am starting to understand how the areas work.
I believe you were correct in creating defaults for a page type. I am not sure why you received a 403 error.
You could try making a copy of the Empty page type. Name it something like "Basic Page", and then edit the defaults for it.
I tried creating a new page type, had the same permissions issue. I did not copy the empty page type, as I don't know where that exists.
I think this could be an issue of the permissions. When concrete5 was installed it was installed as root and then permissions were set only for the application/themes/test directory (test being the copy of elemental).
So if you can point me to where these page types are kept, I can get my boss to change the permission on those directories and I might be good to go.
I did try changing permissions through the GUI, no luck there.
Page Types are not physical files like Page Templates (which are PHP files).
Ok, thank you for helping me.