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.
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…
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…
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 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.
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.
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.
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:
The line <?php print $innerContent; ?> is the most important. Above and below that is the part from your theme.