Jump to content

How to get a different layout on just the homepage


Recommended Posts

I've been working on my own custom skin for CC6 for a few weeks now and there is one thing I would really love to include. I want to have a different layout on the home page than on the category or product pages. In CC4 it was pretty easy to do that but I'm not seeing a way to do it in CC6.

Instead of using main.php for everything but checkout I want to have a template page called home.php or something like that so I can change box locations and so forth just on the home page. I think this will really open up the design possibilities. Does anyone know how to make this work?

Link to comment
Share on other sites

Well, it seems we are past the point of the last available hook, so that won't be an approach we can take.

You could edit main.php and have two main sections. if {$SECTION_NAME} is equal to "homepage", show one section (or include a separate sub-template), otherwise show the original.

 

Link to comment
Share on other sites

I'll give the if/else thing a try and let you know how it works out. Thanks for your help.

When I get this to work I'll be posting this as a free skin in the market place. Yes, it is responsive! A ton of work but it's turning out nicely I think.

Link to comment
Share on other sites

Genius! That works great.

Here is the code I used

In the main.php template file copy all the text between and including <body class="{$SECTION_NAME}"> and </body> and paste it AFTER </body>

Change the first occurrence of

<body class="{$SECTION_NAME}">

to

{if $SECTION_NAME=='home'}

<body class="home">

 

 and then change the second occurrence of

<body class="{$SECTION_NAME}">

to

{else}
<body class="{$SECTION_NAME}">

Then change the last

</body>

to

</body> {/if}

Then change anything you want in the top section of the code for the home page layout (between the {if} and {/if} commands) and the code on the second half is for all the rest of the pages.

Edited by Dodgebill
Link to comment
Share on other sites

I had not yet scrolled down to the bottom of the page to see it start again. When I add the else block it breaks the page... any ideas?

nevermind. Found it. I put {/else} at the bottom instead of {/if}. It's been a very long day....Works great now.

Link to comment
Share on other sites

OK, so here is a funny new wrinkle. With the unique homepage mod in place when you go to the homepage the bxslider no longer works. Tried it in Foundation just to make sure and same thing. Completely baffled on that one. Any ideas where to start? Everything else works just fine.

I have the test site up and running now. It's not a real store. DO NOT ORDER ANYTHING!

http://www.cnkapparel.com/store

This is lingerie based and maybe NSFW but it contains no nudity or adult content.

You can select the different skins (at the bottom) and see the progress. I'm just starting the fashion skin today based on foundation. The other I have been building from scratch (mostly) for the past 2 months and is MUCH farther along.

Edited by Dirty Butter
fixed url
Link to comment
Share on other sites

Just on first inspection, I see:

<ul class="bxslider">
  <li>
      <a href>
          <img>
      </a>
  </li>
</ul>

As an experiment, do not wrap the <img> tag inside an <a> tag. Do not make links out of the images.

Unless, of course, this was working that way before the {if}{else}{/if} edits.

On the other hand, I see this in my javascript console:

 $(document).fashion({equalizer:{equalize_on_stack:true}});

TypeError: $(...).fashion is not a function.

The stock code has:

 $(document).foundation({equalizer:{equalize_on_stack:true}});

So, you would think to replace the name of the skin, 'fashion' from 'foundation'.

No. The javascript function is named 'foundation' (what a coincidence!) and it must stay that way.

Because of this error, the entirety of javascript crashed at that point. The bxslider javascript never got a chance to run.

Link to comment
Share on other sites

It was working with the links until I made the homepage mod. I did just unlink the images just to see and no change. If I remove the mod it works again.

Also, in the fashion skin (foundation based) the navigation subcategory drop downs on hover stopped working as well. It still works in my other skin but that is very differnt.

It seems that there is some sort of error that is causing it to stop all scripts. I've never been able to figure out the debugging method for this for some reason.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...