After changing theme, header, navigation, footer disappeared
Permalink
After spending a bit of time editing my site, which was using the default theme, I decided to try to apply another theme. I didn't like it, so I changed back to the plain yogurt theme. Now I can no longer see the navigation bar, the header, nor the footer. Without the navigation bar (menu), I can't go the the other pages of the site. Is it possible to get these back?
Of course, if nobody answers my question, I'll just start from scratch. But will this happen any time I change the theme of any site I build?
Steve
Of course, if nobody answers my question, I'll just start from scratch. But will this happen any time I change the theme of any site I build?
Steve
It sounds like the GlobalAreas you were putting blocks into may have been named differently in the theme you decided not to use? That's my first thought. Good luck.
This is something that as a relative newcomer to C5 myself I found strange. Somehow I expected C5 would keep track of my content and "move it" into the new theme's areas. But it doesn't do that. Instead if the first theme has a footer area named "Global Footer" and the next one has "Footer One" then your content just disappears. However, it's still there in the database. And normally if you switch back to the first theme, it should just show up again.
If you are comfortable editing the template files, you can open up the themes in question and take some of the areas you used in theme A and put them in theme B on a temporary basis. Then all your content shows up, you move it into the theme B areas and then delete the theme A areas.
This is an aspect of C5 that maybe needs a little bit of rethinking because for one I don't like the idea that my database could be filled with content that no longer shows on the site because it's attached to areas that don't exist in my current theme. Also we need an easier way to recover lost content from themes changes. Like if there was a list of abandoned blocks then we could copy those blocks to clipboard and then paste them into our page areas.
If you are comfortable editing the template files, you can open up the themes in question and take some of the areas you used in theme A and put them in theme B on a temporary basis. Then all your content shows up, you move it into the theme B areas and then delete the theme A areas.
This is an aspect of C5 that maybe needs a little bit of rethinking because for one I don't like the idea that my database could be filled with content that no longer shows on the site because it's attached to areas that don't exist in my current theme. Also we need an easier way to recover lost content from themes changes. Like if there was a list of abandoned blocks then we could copy those blocks to clipboard and then paste them into our page areas.
Thanks for your reply, goldhat. I don't think I'd have a problem editing the template files, but so far, I've only used the ones that came with C5. I'd think, with the themes that are provided initially, at the very least, the C5 folks would make sure the area names match so that the themes are interchangeable.
Thanks again.
P.S. When I restored the default theme, the navigation bar was gone. Since this happened, I started with a fresh install and will back it up before applying other themes. I've used other CMSs and never had a problem like this. Not sure it should be that you get a theme and then have to learn all its area names, but then again, I'm a little new to this, so what do I know? :)
Thanks again.
P.S. When I restored the default theme, the navigation bar was gone. Since this happened, I started with a fresh install and will back it up before applying other themes. I've used other CMSs and never had a problem like this. Not sure it should be that you get a theme and then have to learn all its area names, but then again, I'm a little new to this, so what do I know? :)
There are some standard areas like Main and Sidebar that all themes should have where relevant. With those area names, at least the main parts of all pages should transfer.
You will find some old themes, particularly freebies, that have 'main' instead of 'Main' or completely wrong area names like 'Main Content'.
With new themes providing many configurable standard and global areas, the problems arise where each theme developer has their own ideas about how the naming conventions should be extended.
An 'area name mapper' tool, where you give it an old area name and a new area name and the tool hacks the database to move anything previously associated with the old name into the new name is an idea I have had in my file for ages. (I doubt if its an original idea, other must have thought of the same thing).
It would be useful when changing themes, developing themes, or just when you decide that you want to move everything in 'sidebar' into 'alternate sidebar' across an entire site.
I just haven't had time to look into it further, so any other developer who wants to have a go, you are welcome to the take the idea and develop it.
You will find some old themes, particularly freebies, that have 'main' instead of 'Main' or completely wrong area names like 'Main Content'.
With new themes providing many configurable standard and global areas, the problems arise where each theme developer has their own ideas about how the naming conventions should be extended.
An 'area name mapper' tool, where you give it an old area name and a new area name and the tool hacks the database to move anything previously associated with the old name into the new name is an idea I have had in my file for ages. (I doubt if its an original idea, other must have thought of the same thing).
It would be useful when changing themes, developing themes, or just when you decide that you want to move everything in 'sidebar' into 'alternate sidebar' across an entire site.
I just haven't had time to look into it further, so any other developer who wants to have a go, you are welcome to the take the idea and develop it.
Area name mapper sounds like a good idea. I'd like more though, a bigger suite that includes migrating blocks to areas but goes beyond that. I also want area clean-up features, like blast away all content in an area, or delete all abandoned areas.
I have 'Extreme Clean' currently in the PRB as a free addon. If you (or anyone) has some code to eradicate all traces of abandoned areas, I will happily build that into the addon.
@tallacman has been reviewing/testing and on one old site with considerable history has reduced the database to less than 10% of the before cleaning size, way more than I had expected or achieved in my own testing.
@tallacman has been reviewing/testing and on one old site with considerable history has reduced the database to less than 10% of the before cleaning size, way more than I had expected or achieved in my own testing.
I've attached a single page that might help. It has a class AreaManager that extends the Area model and the method deleteArea is going to delete the record from the Areas table plus wipe out blocks for that area in all collections.
I didn't do anything special here for globalAreas, so for those it should remove the area and blocks but the stack and path records would still be there. Need to check for arIsGlobal flag on the Area and then do extra deletions in that event.
This single page might evolve into a plugin for migrating areas during theme switches because it lists all the site areas, and then the page using that area currently and how many blocks. There is also a link beside each area where you can click to see the blocks in that area. Hopefully useful on a big site where you switch themes and then wonder what content is hiding and what is missing. Now at least you can find it and view it but right now there are no tools to copy it or restore it. Maybe somebody knows a way to add a "copy to clipboard" to the block display? Because if you can copy your lost block out of the old area into clipboard then you can paste it into an active area.
Anyone is welcome to try this file attached and tinker or borrow from it but be warned it has no safeguards or confirms and it gives you an interface with buttons that will delete your content immediately. So use only on testing sites.
Here is the class as an excerpt. Attached file is a single page with an interface.
I didn't do anything special here for globalAreas, so for those it should remove the area and blocks but the stack and path records would still be there. Need to check for arIsGlobal flag on the Area and then do extra deletions in that event.
This single page might evolve into a plugin for migrating areas during theme switches because it lists all the site areas, and then the page using that area currently and how many blocks. There is also a link beside each area where you can click to see the blocks in that area. Hopefully useful on a big site where you switch themes and then wonder what content is hiding and what is missing. Now at least you can find it and view it but right now there are no tools to copy it or restore it. Maybe somebody knows a way to add a "copy to clipboard" to the block display? Because if you can copy your lost block out of the old area into clipboard then you can paste it into an active area.
Anyone is welcome to try this file attached and tinker or borrow from it but be warned it has no safeguards or confirms and it gives you an interface with buttons that will delete your content immediately. So use only on testing sites.
Here is the class as an excerpt. Attached file is a single page with an interface.
<?php defined('C5_EXECUTE') or die("Access Denied."); // class AreaManager class AreaManager extends Concrete5_Model_Area { public function getAreaPages() { $db = Loader::db(); $r = $db->query("select cID from Areas where arHandle = ?", parent::getAreaHandle() ); $areaPages = array(); while ($row = $r->fetchRow()) { $areaPages[] = Page::getByID( $row['cID'] ); } return $areaPages; } public function deleteArea($cid) { $db = Loader::db(); $arHandle = parent::getAreaHandle();
Viewing 15 lines of 32 lines. View entire code block.