Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Nov 21, 2010 @ 19:38
    Anthony Candaele
    0

    how to implement a column object

    Hi,

    I'm new to Umbraco, and for getting a grip on the system, I'm implementing my website in the Umbraco framework. The thing I'm struggling with right now is this:

    My homepage has two text columns in the body. I tried to implement this by creating the properties 'subtitle', 'columncontent' and 'more link' for each of the two column tabs, but this doesn't seem to me the right way to implement this.

    So following Tim Geysens instructions in the Umbraco video tutorial I created a macro container datatype with a macro 'column':

    <xsl:param name="currentPage"/>
        <xsl:variable name="subtitle" select="macro/subtitle"/>
        <xsl:variable name="columncontent" select="macro/columncontent"/>
        <xsl:variable name="morelink" select="macro/morelink"/>   

    <xsl:template match="/">
    <xsl:if test="$subtitle and $columncontent">
      <div class="content">
        <p class="subtitle"><xsl:value-of select="$subtitle"/></p>
        <p><xsl:value-of select="$columncontent"/></p>
        <p><span class="link2"><a href="{umbraco.library:NiceUrl($morelink)}">More</a></span></p>
      </div>
    </xsl:if>
    </xsl:template>

    This works, only problem is that a macro doesn't have a richtextbox datatype.

    So for the moment I'm still wondering how editing data in different columns on a webpage could best be implemented in Umbraco.

     

    Thanks for your advice,

    Anthony Candael
    Belgium


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 21, 2010 @ 23:03
    Jan Skovgaard
    0

    Hi Anthony

    You can do this by creating two tabs on your document type called "Content" and "Sidebar" (or whatever you fancy) and then add a rich text editor property to both of the tabs. This should solve your problem, right?

    I'm asuming that you have already created your templates so you can just create two macroes to get the content fetched into the right columns.

    I'm guessing that your sidebar column probably is more narrow than your content column - therefore it can maybe be a good idea to use another version of the rich text editor, where the width is matching the actual width the contet has on the website. So you can do this by going to the developer section and right click the "Datatypes" and choose to add a new Rich text editor named "Sidebar rich text editor" for instance. You can do without, just a little tip :-)

    Another approach would be to create a content repository at the same level as your website in the content section. This requires that you create some document types, to create the hierachy from in your repository and some document types for the content. Instead of rich text properties on your "content" and "sidebar" tabs you can change them to "content picker" properties, which makes it possible to choose content from any node in the content section...the idea is that you should be able to pick and reuse content from the created content repository. But this approach is probably too cumbersome for the tast that you have a hand at the moment. But maybe it can serve as a inspiration for later...

    Hope it all makes sense and is usefull.

    Happy coding :-)

  • Anthony Candaele 1197 posts 2049 karma points
    Nov 22, 2010 @ 10:31
    Anthony Candaele
    0

    Hi Jan,

    Thanks again for your advice. Good tip on the rich text editor and content repository.

    My problem was not fetching data in a sidebar, but fetching two text columns in the content area. This is the template I'm busy on implementing:

    http://www.4templates.com/view/xhtmlcss-templates/2/AX0591CY

    Like I said, I tried two implement the two text colums with macro containers and this works, the only drawback is that you don't have a rich text editor for editing the text in the text column.

    So after lot's of trial and error, I think I'll just create two tabs on my homepage document type: 'column 1' and 'colum 2' and define three properties for these tabs: 'title" (text), column content (richtext) and link (content picker).

    I think there must be a better solution, because this creates lot's of overhead, you have to define tabs and properties for every column and it seems pretty redundant too.

    Anyway, I learn't a lot this weekend by trying to implement my website in Umbraco. It really is a fantastic Web CMS.

    Cheers,

    Anthony Candaele
    Belgium

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 22, 2010 @ 23:53
    Tim
    1

    Hi Anthony,

    You could have a look at the repeating content datatype in the projects sectionthat allows you to set up an item "template" and then add as many of them as you like to the page. The only problems with that is that the richtext editor it uses isn't the integrated Umbraco one, and it can be a bit flaky (if you have more than one field that uses the repeating type on a page it bugs out).

    The guys that make the awesome uComponents package are meant to be working on something similar, I'm not sure when it'll be released though.......

  • Anthony Candaele 1197 posts 2049 karma points
    Nov 23, 2010 @ 08:17
    Anthony Candaele
    0

    Hi Tim,

    Thanks for the advice. I've heard about uComponents. I'm happily awaiting version 2 :)

    greetings,

    Anthony

Please Sign in or register to post replies

Write your reply to:

Draft