Page 1 of 1

PostPosted: Mon Oct 01, 2007 11:57 am
by njw
Any thoughts on how to make the sidebar items appear as blinds: only the titles are seen unless you click on one, when the whole content is displayed. I've had a look at some frameworks to do this, but I'm not confident how to integrate them into LCMS

Many thanks

Neil

PostPosted: Mon Oct 01, 2007 1:04 pm
by shannah
Hi Neil,

Step 1: In your MainTemplate.html file in the part tha displays the sidebars, we change it to something like:

Code: Select all


{assign var=sidebars value=$page->getRelatedRecordObjects('sidebars')}
{foreach from=$sidebars item=sidebar}
   
   

{$sidebar->val('link_label')}


   

{/foreach}


Note that all we did was create a javascript function named toggle(), then added the onclick event handler to the h3 tag for each sidebar.  We also wrapped the sidebar content in a div tag so that the toggle function could toggle the css class of that div tag.

Step 2: Add some styles to your stylesheet for visible and hidden:

[code]
.visible { display: block}
.hidden {display: none}


This is untested and very simplistic, but this can be used as a basis for arbitrarily complex "blinds" functionality.

In the latest version of Dataface I have included scriptaculous and added a smarty tag to add an animated hide/show sidebar.

-Steve

PostPosted: Mon Oct 01, 2007 7:59 pm
by njw
Many thanks Steve. As you know, simple is best with me!

PostPosted: Tue Oct 02, 2007 3:41 am
by njw
Tried that and got a Smarty error - unknown variable var

Also, I have now realised that I need to be able to make this specific to certain pages.

If I upgraded to v0.7.1 would I get the animated show/hide function or were you referring to the next unpublished version?

Thanks for any help.

Neil

PostPosted: Tue Oct 02, 2007 8:54 am
by shannah
Sorry, you have to surround javascript in {literal}{/literal} tags in smarty because javascript contains the '{' character which is special to smarty. The {literal} tag tells smarty to ignore whatever is inside.

PostPosted: Fri Oct 05, 2007 2:10 am
by njw
Thanks again Steve. Can I easily apply this only to specific pages? For instance, I probably only need this on the home page, which has "news" material, and not on other pages where I am using the sidebar more as menu for related links.

Many thanks

Neil

PostPosted: Fri Oct 05, 2007 11:58 am
by shannah
This is just a tag that you wrap around the text that is offending.

e.g.

..
{literal}