Content and template interwoven (or mixed)

56 views
Skip to first unread message

Youri Ackx

unread,
Apr 18, 2014, 9:59:57 AM4/18/14
to hippo-c...@googlegroups.com
Hello,

I'd like to validate the following approach for a content that is spread in the template.

We need to produce of a page composed of:
  • header (template)
  • menu (template)
  • main image (content)
  • breadcrumb (template)
  • social network icons (template)
  • product list (content)
  • footer (template)
So fragments of a given document (here: main image and product list) and of the template (header, menu, social icons, footer...) are interwoven.

This is how I implemented it:

Template:

hst:pages
    standardprolog
(template=layout.webpage.prolog)
        header
        prolog
(template=standard.main)
        breadcrumb
        social
-share
        main
(template=standard.main)
        footer


Product page:

hst:pages
    product
(referencecomponent=hst:pages/standardprolog)
        prolog
            content
        main
            content
            main

Prolog, main and standardprolog point to their templates which in turn point to their respective JSPs.


webpage-prolog.jsp

<body>
<hst:include ref="header"/>
<hst:include ref="prolog"/>
<hst:include ref="breadcrumb"/>
<hst:include ref="social-share"/>
<hst:include ref="main"/>
<hst:include ref="footer"/>
</body>


Does this approach make sense? The only inelegant thing I see is that the component (Detail extends BaseHstComponent) is called twice to retrieve the bean: once for the prolog and once for the main part. Not even sure it implies a performance penalty. Your opinion is welcome -- and if this is the way to go, this page can serve for someone else.

Thanks

Bert Leunis

unread,
Apr 22, 2014, 2:51:28 AM4/22/14
to hippo-c...@googlegroups.com
Hi Youri,

This looks like a good approach to me. If you are worried about page perfomance problems don't forget you can always use the page diagnostics [1].
The getContentBean() in your components indeed gets you two times the same bean. You can also use this way to get to the content bean instead: request.getRequestContext().getContentBean(). The former method will be deprecated in 7.9 and the latter be the preferred one.




With kind regards/Met vriendelijke groet,
Bert Leunis

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com


--
*** The 2014 Hippo GetTogether will take place on May 16 in Amsterdam, register at http://hgt14.onehippo.org ***
 
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Ard Schrijvers

unread,
Apr 22, 2014, 3:34:34 AM4/22/14
to hippo-c...@googlegroups.com
On Tue, Apr 22, 2014 at 8:51 AM, Bert Leunis <b.le...@onehippo.com> wrote:
> Hi Youri,
>
> This looks like a good approach to me. If you are worried about page
> perfomance problems don't forget you can always use the page diagnostics
> [1].
> The getContentBean() in your components indeed gets you two times the same

For later 7.8.x versions the content bean through the BaseHstComponent
also returns the same instance already, so no performance penalty

Regards Ard
--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 1 Broadway, Cambridge, MA 02142

Youri Ackx

unread,
Apr 23, 2014, 4:36:10 AM4/23/14
to hippo-c...@googlegroups.com
OK good, thank you guys. I was suspecting some caching somewhere would prevent any double hit penalty.
Reply all
Reply to author
Forward
0 new messages