Add editable block to footer.php4 users found helpful
We would like to add an element to the templates that can be managed within concrete gui. For example, a footer are with links, or images, etc. We would like to hard code a reference to the html content managed within concrete5 into the footer.php file.
I have been given code for autonav, but that's navigation and not referencing a specific block/snippet/scrapbook etc.
I just want to make it easy for the client to modify something that is displayed on every template without them needed to add that element to every template and page.
For example, a couple links and a couple graphics, a twitter icon, facebook icon, etc as a scrapbook item, or somewhere else? that I call directly within the footer.php file so it's automatically added to all template types that calls the footer. This also allows my client to edit the scrapbook item to change that footer content.
Maybe you are answering that question, but due to my lack of knowledge it's going over my head :)
If there is something that you know for sure will be on every page and it will look exactly the same on every page, in my opinion, the best solution is to just stick it in the template.
So for example, if you want the auto-nav block in every page on your site, then you could hard-code it into the template using the code I sent you. The upside of this is that it will appear on every page in the same way. The downside (which may not even be a downside) is that you can't configure it via the C5 interface...so any changes would have to be done in the PHP code in the template.
it seems much easier to have one place for a header nav just like the place for the logo.
also the footer is universal and it seem that that is hardcoded in yogurt but it is not accessible by the user for editing only.
i would like to allow other users to edit these (header and footer) without having to resort to hardcoded pages.
i am aware of the scrapbook which is a good thing but i don't think it really solves this need for a universal header and footer.
a couple more points that i have wanted to get out there. page types why have them? why not a pagetype called unbounded that has no banner and lets you do what you want on a page. now that you can use layouts to do columns you can do any sort of layout you want like right column, left column, full, with banner and without all from one page type. there seems no reason for page types unless you want to structure things for users or have a particular look. layouts have sets for that. that is one of the problems with wordpress. every page in wordpress looks like wordpress. why have concrete be limited like that by page types? why not have it be more unbounded?
it seems to me that concrete5 is moving in the direction of the unboundedness of hypercard (if you remember that) but for the web. hypercard for the web is very needed. something that allows non programmers to create pages with buttons and images and scripts to allow it (a site) to look like you want and behave the way you like. like hypercard you click new and you get a blank page. then you decide on a layout and drop in the items you want. beginners can work on the surface level and progress to making scripts with experts making blocks (like the old xmcd's) and modifying the underlying code.
concrete5 is great but if concrete5 could be hypercard for the web it would be huge. excuse me if i got kind of carried away philosophically. :)
I agree to having some misgivings about the way the header nav is handled. Not necessarily about the autonav or menuing blocks that we have, or about the idea of areas in general - or EVEN about master templates, which we have used in many situations (and I'll get to more later) but the fact that, when adding new add-ons to your site, which create new page types, add new sections to your site (e.g. the discussion forums add-on, or the eCommerce add-on) there is no header menu added by default. It'd be really nice if there were some way to designate a block as the preferred method by which a header nav or anything in an area gets displayed, and then have it show up that way across the entire site, even so that new add-ons that aren't coded to look for it specifically will still show the correct block.
Regarding page types: you are completely free to create your site without page types ;-) . Prior to 5.4 we didn't have layouts, so it wasn't as though we could create one large default page and give users the ability to split them into columns. But even now I don't know that I'd dispense with them. Small to medium web shops are some of the biggest users of concrete5, and its with them in mind that we've created page types and their associated templates in their theme's folder. When they do a design for a client, there are typically several different templates and form factors in use on a given site. Page Types gives them a way to easily translate those HTML templates into reusable concrete5 templates, locked down enough to keep their site consistent but still with the nice editing that concrete5 provides.
I have a content block in my footer.php... I populated this content block on the home page and was hoping that because this same footer.php is being used across the whole site, the content would be present [and still editable] on every new page that is added.
It's not! The block is there waiting but doesn't hold any of the content that I have put in.
Does the 'twittered' code that you speak of do this for me?
I am a newbie to Concrete5, less of a newbie to PHP...
You can utilise this to always read the content from a specific page (in this example, we're using Page 1 - the Home page).
$dp = $c->getCollectionID() == 1 ? $c : Page::getByID(1,'ACTIVE'); $a = new Area('Footer'); $a->display($dp);
The result of this is that your block will only be editable on the Home page, but the same content wherever that code gets executed (every page, if it's in your footer).
<?php Block::getByName('Name of your scrapbook block')->display(); ?>
...Then go to Dashboard -> Scrapbook, create a new "global" scrapbook (if it doesn't already exist), add a content block there, and after you've added the block, edit its name to whatever name you used in the code above. For example, if the code was this:
<?php Block::getByName('Footer Content')->display(); ?>
...then you would name that scrapbook block "Footer Content".
I've tried your approach and it didn't work totally. I'm using a couple of block in the footer and when I applied your code to the footer.php the block text did show up, but the functionality of the block was broken.
Like for example I use the Email Newsletter form and when a user puts inside an email address that is already singed up he gets an error. With your approach I don't get this error feedback.
And even the css styling on some pages didn't work correctly.
Even hard coding the HTML into the footer.php didn't resolve the broken functionality of the Email Newsletter block.
Is really the only way to make a permanent footer on all my pages to copy the srapbook blocks to every page, even every blog page?
Need some support!?
Hope that helps.