Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Chris MacDonald
5,166 PointsUsing Foundation with server generated content.
Hi, i have been given the task of looking for a way to use the Foundation framework on user ready e-commerce sites that already use a framework (basically we don't like the one they use), however because it is set up for someone who wants a store to just be able to start, there is a lot of content that is generated server-side. For example just the main navigation when you try and break it down is just this:
<li class="%%GLOBAL_LastChildClass%%"><a href="%%GLOBAL_CategoryLink%%">%%GLOBAL_CategoryName%%</a>
%%GLOBAL_SubCategoryList%%
</li>
the GLOBAL stuff i can't touch, just wondering if anyone with experience (since i am very much a novice) of these things knows if it is even remotely possible?)
all input will be appreciated
thanks
4 Answers
Christopher Sell
7,835 PointsHey Chris, ok I think I have a basic handle on the editor. The good news is it looks like you have some flexibility to bend the templates to your will. It looks like you just have CSS and HTML capabilities (no php or ruby or something like that).
To Get Started Basically, if you log into your site backend and go to the "Design" link near the top and then click on "Browse Template Files..." in the "Current Store Design" section. This will launch the file editor where you'll be able to see all of the template files in your design (Although, you will probably want to use webdav to upload the foundation includes). At this point you'll just need to add the proper class names and probably need to add some DIV wrappers for rows and such as per Foundation's grid system.
I'm unclear about JS in this system, you might have to contact support to add your own JS. This might be a problem if you're wanting to use those piece of Foundation (Orbit, modals, form validation, etc). In the default design I did find a .html file that put their JS within the <script></script> tags. You could try, for example, renaming foundation.min.js to foundation.min.js.html putting:
<script type="text/javascript">
*foundation's javascript goes here*
<script>
then just be sure to include that file/those files in your header.html file. Either way, you can definitely still use all the css (including media queries) that comes with Foundation which is probably a lot what you're looking for anyways.
Navigation To your question about the navigation, it doesn't look like you'll be able to build a GUI for navigation if that's what you're thinking. The way the nav code you posted works is a sort of template engine. The %%something%% tags are interpreted and turned into content before they're rendered. I can't seem to find a list of available template tags, but they should be somewhere, or you might have to ask for them.
Anyways, in the default template, for example, you see the %%Panel.TopMenu%% that pulls in the TopMenu.html file. Within that file is what you're talking about. It looks like it's manually built out and not automatically generated, which will simplify the process. This is where you can add or remove your pages from the navigation section. To use Foundation's design for the top menu, you'll just need to add the proper classes along side what's already there (separated by spaces) just keep in mind some features won't work without the JS.
I hope that helps. Let me know if I misunderstood your questions or need further clarification on anything. Good luck!
Christopher Sell
7,835 PointsHey Chris, could you give a little more information about what you're trying to do exactly? Do you know the name of the current framework? I'm not sure I fully understand what you're asking based on your question. I've built a few sites with Foundation and I love using it. Since Foundation is a front end framework it shouldn't affect the way a content management system operates. Although if you're saying the CMS is generating most of the HTML...then it might be a bit difficult (though not necessarily impossible) to wedge Foundation in there.
Chris MacDonald
5,166 Pointshi, sorry it has taken me so long to reply. I don't know the name of the framework they are currently using, it could even be one they have developed themselves. The easiest way to describe would be to say that it is editing an mybigcommerce.com site, you can do a 15 day free trial there that lets you try, so that's the easiest way to see the code i am dealing with, because all the pages are broken down into smaller html files what they call snippets and panels. For example i want to use foundations top menu system, but the ul's that i need to give class names to they don't exist because it is generated according to what the store owner has set it to, i want to try and use foundation while still allowing the customer to be able to change things in the admin part.
I don't know if that is any clearer.
Chris MacDonald
5,166 Pointshi, thanks for your in depth looking. I had figured out how to use the foundation layout, and get the javascript working, but it was things like orbit and the menu stuff i was trying to get to. I will have another look while looking at what you have said thanks.