Issue adding image block to template pages

Permalink
I'm very new to concrete5, so this may be a simple question.

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:
https://www.concrete5.org/community/forums/customizing_c5/how_to_aut...

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:
https://www.concrete5.org/community/forums/customizing_c5/add-editab...

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,
Heather

2 Attachments

HeatherMyers
 
daenu replied on at Permalink Reply
daenu
Hi HeatherMyers

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:
https://www.concrete5.org/documentation/using-concrete5-7/in-page-ed...

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
/concrete/themes/elemental
to
/application/themes/elemental

Hope this helps. If you have any further question, don't hesitate
HeatherMyers replied on at Permalink Reply
HeatherMyers
Daenu,

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.

Thanks,
Heather
daenu replied on at Permalink Reply
daenu
So after you've managed to create your Global Area, you're almost done! Just return to the page, add a block to that global area and it will appear on all pages. You may change the image then as you like from page to page.
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.
HeatherMyers replied on at Permalink Reply
HeatherMyers
Daenu,

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.

Heather
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi HeatherMyers,

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.
HeatherMyers replied on at Permalink Reply
HeatherMyers
MrKDilkington,

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.

Thanks,
Heather
MrKDilkington replied on at Permalink Reply
MrKDilkington
@HeatherMyers

Page Types are not physical files like Page Templates (which are PHP files).
HeatherMyers replied on at Permalink Reply
HeatherMyers
MrKDilkington,

Ok, thank you for helping me.

Heather
losttheplot replied on at Permalink Reply
Did you get to the bottom of your permissions problem, Heather? I too am getting a 403 error when attempting to edit the defaults of a page type, and I'm not sure what the issue is.
HeatherMyers replied on at Permalink Reply
HeatherMyers
Sorry, I just can't remember if I figured it out or not. Unfortunately we dropped development on the new website and I haven't looked at it in over a year... I tried going through the directories to check times on files, but nothing jumped out as the solution. Sorry I can't be of help.
losttheplot replied on at Permalink Reply
OK, thanks. I'm not new to concrete5, only 5.7. I've tried everything I can to resolve it, so I shall open a new 'issue' thread and see if anyone else can help.
HeatherMyers replied on at Permalink Reply
HeatherMyers
In case I get back to the website, and end up revisiting this issue, could you post a link to your new thread?
losttheplot replied on at Permalink Reply
https://www.concrete5.org/community/forums/customizing_c5/403-error-when-trying-to-edit-the-defaults-of-a-page-type