RSS Feed

Posts Tagged ‘adaptive layout’

  1. Typoscript snippet – intelligent HTML template layout

    November 3, 2011 by admin

    From working with other CMS like Joomla, Drupal and WordPress I’m used to have a certain logic to my template. Assuming a basic three column layout (left sidebar, main content, right sidebar) this is one approach which I will continue to refine in a later article – to only show an area if there is actual published content in this assigned to it.

    So, consequently, you don’t have to manually assign a different layout to pages, post, articles, … but only fill the areas with content and the template will automatically adapt.

    This snippet will only wrap an area if there is a published content element assigned to it.

    temp.LEFTCONTENT < styles.content.getLeft
    temp.LEFTCONTENT.stdWrap {
    	wrap = <div id="left"> |</div>
    	required = 1
    }
     
    temp.MAINCONTENT < styles.content.get
    temp.MAINCONTENT.stdWrap {
    	wrap = <div id="main"> | </div>
    	required = 1
    }
     
    temp.RIGHTCONTENT < styles.content.getRight
    temp.RIGHTCONTENT.stdWrap {
    	wrap = <div id="right"> | </div>
    	required = 1
    }

    Assign the temp objects to available subparts in your HTML template file.

    page.10 = TEMPLATE
    page.10 {
     
    	workOnSubpart = document
     
    	subparts.leftcontent < temp.LEFTCONTENT
    	subparts.maincontent < temp.MAINCONTENT
    	subparts.rightcontent < temp.RIGHTCONTENT
     
    }

    More on styling these resulting areas soon …