What do I do with view.php?

Permalink
I can not find what or how to use view.php. I have a theme I am building, and would like to eventually submit a theme here, but the instructions say a view.php must be included, but I just don't know what it does. I looked in a few other themes at their view.php files but they are different and I could not gather what I was to do. Can someone please tell me what to put in that file. :) I have default.php, home.php, full.php, and some custom page types and they all work, just don't know what to do with view or how to use it. Thank you.

 
okhayat replied on at Permalink Reply
okhayat
That's it. Login, Member, Profiles and other similar pages are all Single Pages.
For those to be viewed within your theme, you must have a view.php
What does it include?
Here's an example from concrete/themes/default/ theme:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
$this->inc('elements/header.php'); ?>
  <div id="central" class="no-sidebar">
    <div id="body">
      <?php print $innerContent; ?>
    </div>
    <div class="spacer">&nbsp;</div>
  </div>
<?php  $this->inc('elements/footer.php'); ?>

The line <?php print $innerContent; ?> is the most important. Above and below that is the part from your theme.
Benji replied on at Permalink Reply
Benji
Did you look at this:http://www.concrete5.org/help/building_with_concrete5/developers/mv...

It's a little obscure to find in the documentation, but that's where they really discuss view.php. The somewhat confusing thing about it is that it can be overwritten for any particular single page by a page-specific template in a theme. So, if in your theme you want the login page to have a look that's different from the register page, for example, you could create separate templates for each single page, but still otherwise use them as single pages (rather than page types). Hope that makes sense.

Basically, view.php can be pretty simple, as illustrated by the post above.

Welcome to c5 Community, by the way. Your website looks very nice. Did you know you can customize Stephane Caron's PrettyPhoto plugin? I noticed you were using the light rounded corner theme, and I customized it for a project to make it a transparent white. But what really made me do it in the first place was that, if you look closely, his white corners aren't white! It kind of got to me. So I just made another theme by copying, pasting, and modifying his light theme, and then altering his sprite image in Fireworks so that it was transparent. If you're interested I could send you the code, but you should at least fix those corners…
thatryan replied on at Permalink Reply
Thanks a lot guys for your help. I think I am getting an idea lol, the documentation just seems a little sparse for me I guess. For example, I get that view.php acts as a wrapper for static single pages, and it does so by displaying the innerContent But, where does that innerContent variable come from? I don't see it anywhere, but if I make a single page named foobar.php whose only code is a big form, that file then becomes the $innerContent and view.php displays it, as well as the header, footer and nav that I include in it? Is that right?

Benji thanks for looking at my site, I am glad it did not cause you trauma. :) I am about to rebuild it actually, but I will keep the customizing in mind if I use that again.
Benji replied on at Permalink Reply
Benji
I believe that $innerContent originates from /concrete/libraries/view.php, line 725. But you don't really need to know that -- all you need to know is that, as you have surmised, $innerContent is whatever code you put in your single page.

The documentation is indeed a little sparse in areas, but I think Andrew, Franz, and co. are doing a tremendous job considering how few they are.