Replacing Home Page

Permalink
Hi,

I've created a new homepage and I'd like to replace the old one but can't see how to get it out of being a subpage. Any thoughts?

Amanda

madelikethis
View Replies:
vincedelaking replied on at Permalink Reply
vincedelaking
Hi Amanda,

Did you made your changes on your default.php in your theme directory, or added a page under 'home' in your dashboard sitemap?

best,
Vincent
madelikethis replied on at Permalink Reply
madelikethis
Hi Vincent,

Basically the form on my homepage isn't working. I changed it in the template and now it will work on new pages, so I must create a new homepage, but it will look exactly the same as the other one and matches the template. I didn't change a home.php file.

Amanda
vincedelaking replied on at Permalink Reply
vincedelaking
Correct me If I'm wrong but as far as I know you cannot point a childpage from home (sitemap) as a new homepage. The default.php in your theme is always refert as the homepage. So maybe you can copy the code from the template into home or default.php a take it from there.
Dinamicore replied on at Permalink Reply
Dinamicore
The only way to replicate the home page is to manually copy it; using the scrapbok to copy and paste its blocks.
AlchemyGFX replied on at Permalink Reply
GRRRRRR!!!! This is not good. It is not unusual to start a new site with "home" being an "under construction" placeholder page with no nav, while developing other pages, as I have done. Now the "real" home page cannot be moved other than manually. ARGGG!

Any devs reading, please fix this :-)
mhawke replied on at Permalink Reply
mhawke
Let's go back to the basics of how concrete5 works to see if we can find a solution. Concrete5 works through the use of different 'Page Types'. The problem is that you started creating your new home page as a page already in your navigation. What you need to do instead is create a new 'page type' and build that page up in the 'Page Defaults' area. Then you can re-assign your existing homepage to use your newly designed homepage.

Try this:

1) Find out what page type file is assigned with the new page you have designed (the one sitting in your nav that you want to move to the 'home' position) by hovering over the Edit button, choosing 'Design' and noting the name of the page type. Go to '[root]\themes\your-theme\" and make a copy of this file but call it 'new_homepage.php" and place it in your themes folder with the rest of your page type files (like right_sidebar.php and left_sidebar.php, etc.). When I say 'make a copy' I mean through FTP not making a copy through the C5 sitemap.

2) Visit 'Dashboard->Themes' and click the 'Inspect' for your theme.

3) C5 will list your new page with a checkbox beside it.

4) Click the 'Ok' button and your new page type will be added to your system.

5) Go to 'Dashboard->Page Types' and you should see your 'New Homepage' listed.

6) Click 'Defaults' button next to 'New Homepage' and when the page opens, click 'Edit. You are now able to add content to your 'New Homepage'.

7) Build to your heart's content until you are happy with the results. Yes this means that you need to rebuilt the page you already built in your nav but that's where the clipboard comes in. In a separate browser tab, open the page in your nav with all your new homepage content on it and copy the blocks to the clipboard. Switch back to the 'Page Defaults' tab and paste the blocks into the corresponding areas in your new page. You can polish this page by editing both the html structure of the page itself or adding blocks to the different areas within the C5 environment.

When you are happy with what you have created, simply hover the Edit button for your existing Homepage and choose 'Design'. Choose 'New Homepage' for the page type and voila, you have a new homepage. You can then edit your new homepage just like any other page or you can make changes 'behind the scenes' in the 'Page Defaults' area and then use the 'Setup on Child Pages' feature to propagate block changes out to the homepage.

Clear as mud?
JohntheFish replied on at Permalink Reply
JohntheFish
Have a look at 'maintenance mode'. You can theme it to fit your site as per:
http://www.concrete5.org/documentation/how-tos/designers/themimg-sy...
mhawke replied on at Permalink Reply
mhawke
Sorry JohntheFish... I don't follow. Are you suggesting we can use a single page as a new home page? How do you swap them out?
JohntheFish replied on at Permalink Reply
JohntheFish
No, I am noting that the original issue of having a temporary home page while developing site content can be partly (but not completely) avoided by using maintenance mode.

I should have added that you can do more if you use the maintenance editor addon.
http://www.concrete5.org/marketplace/addons/maintenance-editor/...
cnrx replied on at Permalink Reply
cnrx
Assuming you want to GROUP SUB-PAGES under "Home" at the NAV menu:

Home
-> About us (sub-page 1 to Home - has no sub-pages)
-> History (sub-page 2 to Home - has no sub-pages)
-> Background (sub-page 3 to Home - has no sub-pages)
Projects (has sub-pages we want to display)
-> Project A
-> Project B
-> Project C
Products (has sub-pages we want to display)
-> Product Category 1
-> Product Category 2
Contact Us (no sub-pages)

INSTEAD OF THIS:
Home
About us (sub-page 1 to Home - has no sub-pages)
History (sub-page 2 to Home - has no sub-pages)
Background (sub-page 3 to Home - has no sub-pages)
Projects (has sub-pages we want to display)
-> Project A
-> Project B
-> Project C
Products (has sub-pages we want to display)
-> Product Category 1
-> Product Category 2
Contact Us (no sub-pages)

...then the issue is a navigation issue:
Currently, in C5 if you display the Home (or whatever you may have renamed it to) at the NAV, then it does not display sub-pages, and there's a good reason for it.
However, if you're porting from another CMS you may want to use this structure.

The solution is to create a TEMPLATE for the AUTONAV block (i.e. copy the \concrete\blocks\autonav\templates\responsive_header_navigation\view.php INTO \application\blocks\autonav\templates\responsive_header_navigation_home_subpages\view.php) and then replace the part underneath the following comment
//*** Step 2 of 2: Output menu HTML ***/

with the following code:
echo '<nav class="ccm-responsive-navigation original"><ul>'; //opens the top-level menu
$homeSubmenu = false; //*CNRX* // This flags the "Home" special case
foreach ($navItems as $ni) {
   /* CNRX block starts */
   if ($homeSubmenu && $ni->cObj->cChildren > 0) { // This will close the "Home" <ul> when it encounters a sub-page that has children
      echo '</ul></li>'; //closes the home nav sub-items
      $homeSubmenu = false;
   }
   /* CNRX block ends */
    echo '<li class="' . $ni->classes . '">'; //opens a nav item
    $name = (isset($translate) && $translate == true) ? t($ni->name) : $ni->name;
    echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $name . '</a>';
    if ($ni->hasSubmenu) {
        echo '<ul>'; //opens a dropdown sub-menu
    } else {


THIS CODE IS BASED ON C5 VERSION 5.7.4.2

This will display all direct sub-pages to Home (that have no sub-pages themselves) in a sub-menu until it encounters a page with sub-pages (e.g. Projects in the example above). It is important that these appear in order in the sitemap.
The moment the code encounters a page that has sub-pages itself, it will create a new top menu item for it.
Following that, other sub-pages to Home will appear as normal (e.g. Contact Us, above)

You need to make sure of the following:
1. Pages you want to appear under the "Home" sub-menu directly follow Home in the Sitemap
2. The "Home" page does not have the "Exclude From Nav" attribute set to true
3. The "Home" page does not have the "Exclude Sub-Pages From Nav" attribute set to true
4. This should work even with without setting a set level of sub-pages. It will, however, look much better with 1 level of sub-pages.

Hope this helps someone out there.

Best of luck