Alternate home pages

Permalink
Is there a way do designate the home page in c5, I have been trying to build out some templates and have alternate home page layouts so the end user can pick a homepage layout.

Any ideas or solutions for this.

 
jelthure replied on at Permalink Reply
jelthure
simple, you can create the different home pages as page types. then add an user attribute (text or select) called something like "home page type" and assign it to users entering the handle of the page type. so if your page type file is called home_page2.php, you'd assign the handle home_page2 to users you would like to see that page type. After that all you need to do is add some code to say the header_required.php file that first checks if the page being requested is the home page, then gets the current user and the value of their home page type attribute, then change the page type to the one defined.

hope this makes sense, and helps you out!
aaron replied on at Permalink Reply
I planned on having the pages pre-built with content, under the home nav using the same page type the difference being the block content.

Could I set a custom page attribute and do a header re-direct to that page attribute or something.
jelthure replied on at Permalink Reply
jelthure
pre built with content, do you mean like static content, or like you were gonna create and add content to the pages as you would with other pages on the site? (using blocks, etc...)
ijessup replied on at Permalink Reply
ijessup
Are you planning on packaging this? Because there's tons of things you can do with during the package install process when you tap into c5's API.
aaron replied on at Permalink Reply
What I wanted to do was create a theme with multiple homepage layouts similar to sites in theme forest and basically have them include custom layouts and unique blocks already on the page then somehow specify which one the user wanted as his active home page.
ijessup replied on at Permalink Reply
ijessup
It's probably overkill, but you could create a theme config page in the dashboard.

The only reason why I wouldn't agree with multiple page_types is because that could get messy really quick.

If it is only the home page, why not just make multiple themes that all get installed at the same time?
aaron replied on at Permalink Reply
I think it would also be messy creating more themes, I am almost adding a config to the site map or adding it to the dashboard.
ijessup replied on at Permalink Reply
ijessup
This introduces an interesting concept. Might make for a great way to extend the Theme Customization page in the dashboard. That way there are standards in place, and there isn't an extra page on the Dashboard nav menu when you aren't using the theme.
jelthure replied on at Permalink Reply
jelthure
I would still go with the user attribute and multiple home page types. you can then either hard code the blocks you want into the page types or code them to pull from the scrapbook. the later would still give you the ability to edit/change/move the blocks that show up on the page.
aaron replied on at Permalink Reply
I am still thinking of packaging a block, that adds a page to the site map that lets a user pick any page to be the home page of the site and setting a redirect to that page.
ijessup replied on at Permalink Reply
ijessup
That's certainly an option. You wouldn't need a block though.

What you could do is create a Select attribute with the appropriate values and then have it redirect based on the selected value. They would be forced to change it from the Sitemap, but they'd have to go the Dashboard either way.
jelthure replied on at Permalink Reply
jelthure
why would they be forced to change it in the dashboard? Wouldn't it be best to set it up as a user attribute which is editable on there profile page? I mean from my understanding the "users" of this scenario are just registered users, not necessarily users with dashboard access, am I wrong?
ijessup replied on at Permalink Reply
ijessup
I must have missed something thing. I wasn't aware this was "registered user" specific. In that case, I would say definitely make it a User Attribute and redirect that way.
aaron replied on at Permalink Reply
I was simply looking for a way to let the site admin set an alternate home page.
ijessup replied on at Permalink Reply
ijessup
Ok, if it's site admin only, then I would just make a new Collection(Page) Attribute.
adamjohnson replied on at Permalink Reply
adamjohnson
Uh, isn't this essentially targeted content for specific user groups? Could be a combination of advanced permissions and the Targeted Content add on:

http://www.concrete5.org/marketplace/addons/targeted-content/...

Maybe this is a six in one, half a dozen in the other scenario--or I could just be missing the mark entirely...
jelthure replied on at Permalink Reply
jelthure
nah, no need to purchase a addon for something simple like this, it's only a matter of site configuration and a little bit of coding within the theme or modification of header_required file.
TheRealSean replied on at Permalink Reply
TheRealSean
I also think that page types would be a good solution,

You could set up different areas on the home page and pull that content in from the scrapbook.

Different Page Types would allow the different layouts of the content and if you specify those areas where you want you new content, or where you want to hide content(remove the area)

That way you can change the home page layout from the home page and see what it looks like whilst still on the page.

That is if you would like the home page to be the alternate version for everybody and not just user specific
TheRealSean replied on at Permalink Reply
TheRealSean
One bit of code I am quite fond of using now is the following

It Looks in the scrapbook for a block, if it does not find it it displays an area. With this I can often add content to areas of my choice of add a global block.

It could be modified further to display the area over the Global block if blocks existed within the area or even based on a user/page attribute
$a = new Area('Slogan');
         $block = Block::getByName('Header_Slogan');  
         if( $block && $block->bID ) $block->display();
         else $a->display($c);
aaron replied on at Permalink Reply
These solutions could work the only reason I wanted to not go this route is I wanted to use layouts vs areas so the end user would have more flexibility.