Single page no nav

Permalink
I have successfully created a working single page, however it excludes the Header Nav...
<?php 
$a = new Area('Header Nav');
$a->display($c);
?>

...even though it is included in the header.php and can be seen on all non-singular pages. how do I get it to automatically display the Header nav Block?



Also, is there a way of creating a single page that excludes both the header and footer parts?

MattGreyDesign
 
Benji replied on at Permalink Reply
Benji
What shows up on a single page depends on 2 files: the "wrapper" (usually view.php, unless you've made a custom wrapper) and the "content" (the single page file). One possible explanation to your problem is that you were expecting your single page to get wrapped in your usual template file for a particular page type, which had the Header Nav in it. But when it got wrapped in view.php, it didn't have the Header Nav in it, and so it didn't show up.

If that's not the case, then maybe you can post again and be specific about which file declares the Header Nav area, which might clue us in to what the problem could be.

The answer to your second question would be to simply create a wrapper file that doesn't include the header or footer. Either you could modify view.php, which would then apply to all your single pages for that theme, or you could create a custom wrapper for each single page. Seehttp://www.concrete5.org/documentation/developers/pages/single-page...
UnSaniT replied on at Permalink Reply
I know this thread is a little old, but I am having the same problem so I thought I'd bump it.

I am trying to apply the default wrapper for a single page (login.php) using a custom theme. What I did was copy left_sidebar.php into view.php, removing certain portions that print normal content and replacing them with
print $innerContent;


The layout and css comes up correctly, but the 'Header Nav', 'Main Nav' and 'Footer' areas do not print code. The view.php includes the header.php, which has
<?php  Loader::element('header_required'); ?>
as well as
<div id="meta_nav">
                    <?
                        $a = new Area("Header Nav");
                        $a->display($c);
                    ?>
                    </div>
                    <div id="main_nav">
                    <?
                        $a = new Area("Main Nav");
                        $a->display($c);
                    ?>
</div>


Because both single pages and regular pagetypes both include the same header.php file, I don't understand why there is no content. Can anyone explain how I can get the content to appear in the areas for login.php?

Thanks
Benji replied on at Permalink Reply
Benji
When you say that the Areas do not print code, what exactly do you mean? Can you see them and edit them, but they just aren't displaying your defaults? Perhaps you set up defaults for your left_sidebar page type and you were expecting them to appear on the single page. If so, you'll just need to place the content here as well, because those defaults are only per page type.

If that's not the case, then maybe you can clarify what you mean.
UnSaniT replied on at Permalink Reply
I think what you are suggesting is correct, though I am very unfamiliar with c5. I am trying to do this for someone else. I have a lot of experience with php, though.

When I say they don't print code, I mean that display method call, which is supposed to print the HTML for the page, produces no HTML. The <div> containers are empty if you view source.

When I log in as administrator and go to the /login page, I don't have bar at the top allowing me to edit it. Is this because I need to put the page in /single_page dir instead of /concrete/single_page?

When you say, "need to place the content here as well," I am not sure how to do that, especially since I can't edit the page with c5 directly.

Unless someone can explain why I can't edit the page with c5 directly, I'm looking for a method to add or hardcode the content with php.

I am also not sure how you would usually add the content. Is normal procedure to define the areas in view.php (as I have done), and then edit them with c5 to add the blocks?
Benji replied on at Permalink Reply
Benji
OK, I see. First of all, you need to go to /config/site_theme_paths.php and add the line:
$v->setThemeByPath('/login', 'YOURTHEME');

if you haven't done so already. Of course, replace "YOURTHEME" with the name of the folder for the theme that you want the login page to be wrapped in.

Second, the wrapper file should reside at /themes/YOURTHEME/view.php or /themes/YOURTHEME/login.php. View.php gets applied to all single pages that are wrapped in that theme. Login.php gets applied only to the login.php single page.

Third, you can either choose to use the single page at /concrete/single_pages/login.php or you can make your own single page at /single_pages/login.php. If you make your own single page, concrete5 will use that page instead of the one in the /concrete directory whenever someone visits the login page. If you don't make your own login single page, c5 will use the one in the concrete folder. Either way, you should not modify the /concrete one at all. If you make your own login single page, you can copy the markup from concrete5's login single page and modify it all you want.

Now, the reason you're not getting the edit buttons, etc. at the top of the page has nothing to do with Areas. Probably what's causing the problem is that you left out the line
<?php Loader::element('header_required'); ?>

in the <head> of the wrapper. If that's not the case, it might also be because you broke javascript or included jQuery twice or something like that.

Once you get that resolved, your last paragraph is right -- define the editable Areas in your template or single page and then add blocks to them in the c5 edit interface. If you put the Areas in view.php, then they'll be editable on all single pages wrapped in that theme. If that's not what you want, make a wrapper file at /themes/YOURTHEME/login.php instead so that the Areas only appear on the login page. Or, if you're going to make your own login single page, put the Areas in there instead of in the wrapper if that makes more sense. It all depends on what you want to do, but those are the options anyway.

I hope that makes sense to you. You should read the documentation on single pages too, because it explains all of this pretty well.
UnSaniT replied on at Permalink Reply
I already did the first two things, setting the theme for the single page as well as putting view.php in the correct dir. I am currently using the concrete5 login.php, but I may try copying it to the /single_pages.

The <head> thing has some problem. I copied the contents of another pagetype template to create view.php, which has the element('header_required') line. But the login page is missing a bunch of <script> tags that are missing when you are on other pages (and logged in as an admin).

Are you sure that it's not showing because you aren't supposed to be able to edit the c5 login page? That would make sense.

I have been through the documentation more than once, and with every response I get a better understanding of this. I will try out some stuff tomorrow hopefully. Thank you for your help.
Benji replied on at Permalink Reply
Benji
Yeah, it's not because it's the c5 login page that it's not allowing you to edit it. You should see the c5 bar at the top of every page when you're logged in as an admin. I'm going to guess that it's a script conflict. Is there anything different about this page as opposed to your left_sidebar page? I've copied my left_sidebar template for a certain theme into the view.php file before and had no problems.

You're sure you're not including jQuery in your wrapper? Because it's already included in the 'header_required' call, so if you include it again, the c5 bar won't show.

Probably you should strip down your wrapper to the bare minimum, get it working, and then gradually add stuff back in until you find what makes it bork.
UnSaniT replied on at Permalink Reply
Thanks again for all your help.

I cant make changes to the site tonight, but tomorrow morning I will try what you have suggested (incremental changes to see when it works). I will also try another template file.

I don't see anything that would cause a script conflict, but I don't have the latest copy of the files so I can't be sure.

I'm not familiar with jQuery. How can I check if it is included? There are a couple of references to some jQuery .js files (<script> tags) in the source for the /login, but they are also in the source for other, working pages.