Single Pages + Page Types

Permalink 1 user found helpful
I have a nice single page which does a whole bunch of work... seems to work nicely.

However... I want that page to use a different page type (i.e. other than my view.php in the theme directory)

Is there any way to create a new page type and set it when the package that contains my single page is installed...

For example my current install looks like:

$sp0 = SinglePage::add('addleague',$pkg);
$sp0->setAttribute('exclude_nav',1);

Id like to be able to force it to use this new page type...

Any help would be awesome!

Thanks

5fly
 
igrieves replied on at Permalink Reply
igrieves
Hi,

You will need to create a new page type in Dreamweaver and upload it. Once uploaded you will need to go to Pages and Themes and 'Inspect' the page to create it. Once done you can create a new pagein the usual way and select your new page type from the gallery.

Ian
JohntheFish replied on at Permalink Reply
JohntheFish
That is the procedure for ordinary pages, but I don't think it will work for single pages.

If you don't actually need the original view.php for any other pages on the site, just override/modify it.

If you effectively need 2 different views for different sets of single pages, here are some thoughts that may get you started (some are purely concepts and completely untried):

A. Create a copy of your theme. Modify the view of your new cloned theme to the layout you want. Assign the new theme to the single pages that need the different layout.design.

B. Put some conditional code in the view.php to switch between designs depending on an attribute. Assign the attribute to single pages depending what you want them to look like.

C. As (B), but switch on something other than an attribute (eg, part of the path).

D. If it is only layout variations (eg optional footer or sidebar), modify view.php to display the additional areas, but only if they have content (I have used this ploy, so its tried and tested).
5fly replied on at Permalink Reply
5fly
Thanks.

I do need the view.php for other single pages... there are just a couple of specific single pages that I want to use another page type...

For example I'd quite like to create a new page type specifically for popup single pages (with no page furniture etc)
5fly replied on at Permalink Reply
5fly
But yes, seems like option B would work...! :)

I dont suppose you would have some code to hand that would allow me to add the custom attribute and apply it to the page via my package installer?!

Thanks
JohntheFish replied on at Permalink Reply
JohntheFish
Sorry, B is just an idea, not one I have code for.

There are some themes that are designed for popups and exporting to places like facebook, so maybe one of those would be of use.
RadiantWeb replied on at Permalink Reply
RadiantWeb
any single page can be themed by your root/config/site_theme_paths.php file.

add your theme path and related single page to your theme folder. move the single page to there. then add includes as needed for different headers and footers.

ChadStrat
jasonkf1 replied on at Permalink Reply
jasonkf1
While a single_page override is often the way to go regarding custom layouts/functionality sometimes you may want to enforce a layout where you may not always know the resulting path. Situations such as using the blogga package. The path will be determined by the author and it's very tedious to keep modifying the site_theme_paths.php file.

You can achieve this by using page attributes mentioned by JohntheFish.

A code example of this in the view.php file in your theme directory would be:

$thisPage = Page::getCurrentPage();
if(is_object($thisPage)){
   if($thisPage->getAttribute('blogga_parent') || $thisPage->getAttribute('blogga_post')){
?>
   <div id="central" class="central-mid">
      <div id="sidebar-left">
         <?php 
         $as = new Area('Left Sidebar');
         $as->display($c);
         ?>      
      </div>
      <div id="body">   
         <?php print $innerContent; ?>
      </div>
      <div id="sidebar-right">


Please feel free to comment on the code, and if needed I'm more than happy to make adjustments to benefit the concrete5 community.