ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

template optimization

July 29, 2009 4:55am

Subscribe [4]
  • #1 / Jul 29, 2009 4:55am

    MarcinM

    17 posts

    I’ve been looking for any info about optimal template construction - I just finished setting up some site and have a filling, that some part of the website are really slow (comparing to other). The stranges thing is that is for almost static pages.
    So, because of that, I’ve some questions:

    1. First, a template construction:
    a)

    {exp:weblog:entries}
    {embed="includes/header" title="{title}" }
    <h2>{title}</h2>
    <p>{body}<br />
    {embed="includes/sidebar"}<br />
    {embed="includes/footer"}<br />
    {/exp:weblog:entries}

    or
    b)

    {embed="includes/header" title="XXX" }
    {exp:weblog:entries}
    <h2>{title}</h2>
    <p>{body}<br />
    {/exp:weblog:entries}<br />
    {embed="includes/sidebar"}<br />
    {embed="includes/footer"}

    Any difference? any effect in time of page rendeing? the a. is better for me, cause I can have title, keywords etc. passed to header, but also get some white spaces before <doctype>.

    2. dynamic=“on” or url_title=“X” for an exp:weblog:entries tag
    With one if faster to render, are there any guidelines to use one instand of other?
    And what is the best practice to set it with require_entry=“yes” - just to have en entry I exactly want to have (404 redirect at no_result).

    3. is it a good practice to have weblog with only one entry containing all the informations for some section of website (for example “Contact” with phones, adresses, maps etc) and specyfic template group for this section with index that has conditionals to show some custom fields that should be show for current segment_2. Is it can be the problem.

    Thanks for any advises.

  • #2 / Jul 29, 2009 5:51am

    Ingmar

    29245 posts

    Yes, this makes a difference. In the lit. a), all three embeds are called & embedded for every entry in the weblog loop. Dynamic=“on” is default behavior anyway.

  • #3 / Jul 29, 2009 5:57am

    MarcinM

    17 posts

    a), all three embeds are called & embedded for every entry in the weblog loop.

    But what if there is only one entry? I mean I’ve got url_title set in {exp:weblog:entries} tag or I’m using dynamic=“on” to get sepcyfic entry based on URL - it still metter?

  • #4 / Jul 29, 2009 6:12am

    Ingmar

    29245 posts

    That would certainly be better, yes. Either way, just test it, it’s impossible to give definitive optimization advice for all systems and setups.

  • #5 / Jul 29, 2009 9:57am

    Boyink!

    5011 posts

    A couple of thoughts:

    - Make sure to look into what you can disable in the weblog entries loop.
    - Make sure to look into EE’s caching options.

  • #6 / Jul 29, 2009 10:11am

    MarcinM

    17 posts

    - Make sure to look into what you can disable in the weblog entries loop.
    - Make sure to look into EE’s caching options.

    Got both set like it is said at wiki (hope so 😊

    The wiki link I put above is the only one I foundabout optimization ... do you know some other?

    So far I know, that b) is better then a), even if a) case got only one entry. I’ll have to rewrite my templates and will see if it will work
    (that wont be ease, I’ll lost my titles, keywords etc :(

  • #7 / Jul 29, 2009 10:16am

    Boyink!

    5011 posts

    I don’t know any “secrets” past whats on the wiki if that’s what you are asking.

    I’d also recommend trying:

    {embed="includes/header" title="{exp:weblog:entries}{title}{/exp:weblog:entries}" }
    {exp:weblog:entries}
    <h2>{title}</h2>
    <p>{body}<br />
    {/exp:weblog:entries}<br />
    {embed="includes/sidebar"}<br />
    {embed="includes/footer"}

    I’ve done that sort of construct on a number of sites (making sure to use the same disabling/caching direction) and have acceptable performance.

    Sometimes performance issues can come down to hosting as well…;)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases