1383 Posts in 492 Topics by 521 members
Page: 1 2
|Go to End||Next >|
14 June 2011 at 10:39pm Last edited: 15 June 2011 7:53am
Is it possible to create holder for subpages to output layout from subpages as they are? Example: you have subpage1 with 3 columns and subpage2 with 4 columns. Holder collects these to itself and outputs html page – first content and layout from subpage1 and under it subpage2 layout and content?
If this is possible, it gives an endless possibilities to create layout for one page, even some js-animation for revealing content from subpages. Or is this just a pointless idea?
18 June 2011 at 11:04pm Last edited: 18 June 2011 11:05pm
Are you thinking on using different stylesheets only? Or different templates (as well)? And is this a holder page that would show content of multiple pages/pagetypes at the same time, all with their many different layouts? That would be somewhat complex... I suppose it can still be done, but doable?
19 June 2011 at 5:24am
Actually, stylesheets are the same, but child pages include different layout as columns. Columns are added in the administration view as column1 tab, column2 tab, and column3 tab. Templates uses 960gs and the final layouts are created with classes.
I think it should be a holder page that would show content of multiple pages/pagetypes at the same page (inside itself). How you "gurus" would start to figure this out? At the moment, I do not know where to start...
23 June 2011 at 12:11am
Still thinking on this...
If you were to know in advance what different layouts you were going to use, it's easy: you could use a conditional <% if .... %> <% elseif %> <% end_if %> in your <% control %> block that loops through the pages, and provide appropriate layouts...
Making it dynamice/extendable is a different thing:
- I don't think the <% include %> block accepts variables...
- you can't parse the template from a Controller function, since you have no access to controller methods from within the control block...
- You could consider parsing the template from a Datamodel function, but there you can't use RenderWith(), and having it return HTML would be no option I think...
- so now I think maybe you could use the Datamodel function above to instantiate a controller, and use a function within it to parse the appropriate template using RenderWith(). Never done that, but hey...
Google Summer of Code Hacker
23 June 2011 at 11:32am
1) Just to be sure: We're talking about subpages in the CMS and not about inheritance here, right?
2) Isn't http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls#and-lt-control-children-and-gt what you want or did I misunderstand your problem?
23 June 2011 at 6:36pm
Could this picture illustrate it any... If we have a Product page on sitetree and child pages called product 1 (using page type 3column layout) and product 2 (using page type 4column layout) under Product page, I try to render these two child pages $Layout inside Product page. Product page should work dynamically and add new child page layouts after each other, based on CMS sitetree. Or I could use this technique to make pages scrollable on iPad, some kind of "content scroller", eh?
23 June 2011 at 10:03pm
OK, maybe I was taking it a bit too far wanting to make it all dynamic and extendable, sorry for that
Try a simple conditional in your PageHolder.ss template:
<% control Children %>
<% if ClassName = PageType1 %>
<!-- use some layout-->
<% elseif ClassName = PageType2 %>
<!-- use some other layout-->
<% elseif ClassName = PageType3 %>
<!-- yet another layout -->
<% end_if %>
<% end_control %>
Google Summer of Code Hacker
23 June 2011 at 10:18pm
Yes martimiz, that's what I was thinking about. Not sure if it's flexible enough, but probably a good start...
Page: 1 2
|Go to Top||Next >|