>      Are you running radiant/rails through CGI?

No, it's running on Mongrel.

I've been benchmarking the script - the slowness is coming from  
recursively calling <r:snippet name="sub-nav" />. Each time the sub- 
nav snippet is called takes about 0.05 - 0.1 seconds. For a large  
site, that adds up to a very slow load time. I'm not sure yet if it's  
rendering the snippet that takes so long, or if it's my tag that's  
inefficient.


On Jun 22, 2007, at 3:41 AM, Aitor Garay-Romero wrote:

>> * Slow as molasses. On http://biola.artofmission.com, regenerating a
> page can take as long as 2 seconds.
>
>      Are you running radiant/rails through CGI?
>
>     /AITOR
>
>
> On 6/22/07, Ryan Heneise <[EMAIL PROTECTED]> wrote:
>>
>> In the spirit of The Rails Way Free-for-all (http://
>> www.therailsway.com/2007/6/4/free-for-all-tab-helper), I thought it
>> would be fun to see how we all handle making dynamic navigation for
>> Radiant sites.
>>
>> PROBLEM: I have a hierarchical site, where each page has several
>> children, and some children also have children. I want a  standard
>> left-hand navigation menu. It should be automatically generated. The
>> navigation menu should show the children for only the current page,
>> and it should expand to show the parents and ancestors of the current
>> page.
>>
>> Example:
>>
>> - Home
>>    + About
>>    - Articles
>>      - Article 1 -- you are here
>>      + Article 2
>>    + Widgets
>>    + Hoozits
>>    + Whatzits
>>
>> (- expanded pages)
>> (+ unexpanded pages)
>>
>> If you've done this in Radiant, please post your solution. See mine
>> in action at http://radiant.artofmission.com/ Username: demo,
>> password: radiant. Also see http://biola.artofmission.com (under
>> construction)
>>
>> Pro:
>> * Easy & foolproof - content editors don't even have to think about
>> navigation - it just happens for them.
>> * Automatic - new pages show up in nav automatically.
>>
>> Con:
>> * Slow as molasses. On http://biola.artofmission.com, regenerating a
>> page can take as long as 2 seconds.
>>
>> Here's my code:
>>
>> == Snippets ==
>>
>> === Nav ===
>> <div id="nav">
>>    <r:find url="/">
>>      <ul>
>>        <li<r:if_self> class="current"</r:if_self>><a href="/">Home</
>> a></li>
>>        <r:children:each>
>>          <r:snippet name="sub-nav" />
>>        </r:children:each>
>>      </ul>
>>    </r:find>
>> </div>
>>
>> === sub-nav ===
>> <r:unless_content part="no-map">
>>    <li<r:if_self> class="current"</r:if_self>><a href="<r:url />"
>> title="<r:title />"><r:breadcrumb /></a>
>>      <r:if_children>
>>      <r:if_ancestor_or_self>
>>        <ul>
>>          <r:children:each>
>>            <r:snippet name="sub-nav" />
>>          </r:children:each>
>>        </ul>
>>      </r:if_ancestor_or_self>
>>      </r:if_children>
>>    </li>
>> </r:unless_content>
>>
>>
>> == Tags ==
>> http://svn.artofmission.com/svn/plugins/radiant/plugins/ 
>> navigation_tags
>>
>> require 'standard_tags' # make sure we have the previous definition
>> first
>>
>> module StandardTags
>>
>>    include Radiant::Taggable
>>
>>    # Inspired by this thread:
>>    # http://www.mail-archive.com/[email protected]/
>> msg03234.html
>>    desc %{
>>      Renders the contained element if the current item is an ancestor
>> of the current page or if it is the page itself.
>>    }
>>    tag "if_ancestor_or_self" do |tag|
>>      tag.expand if tag.globals.actual_page.url.starts_with?
>> (tag.locals.page.url)
>>    end
>>
>>    desc %{
>>      Renders the contained element if the current item is also the
>> current page.
>>    }
>>    tag "if_self" do |tag|
>>      tag.expand if tag.locals.page == tag.globals.actual_page
>>    end
>>
>>    desc %{
>>      Renders the contained elements only if the current contextual
>> page has children.
>>
>>      *Usage:*
>>      <pre><code><r:if_children>...</r:if_children></code></pre>
>>    }
>>    tag "if_children" do |tag|
>>      children = tag.locals.page.children
>>      tag.expand if children.size > 0
>>    end
>>
>> end
>>
>>
>>
>> _______________________________________________
>> Radiant mailing list
>> Post:   [email protected]
>> Search: http://radiantcms.org/mailing-list/search/
>> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>>
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>

------------------------------------------------
Ryan Heneise
Art of Mission, Inc.
3720 Gattis School Rd #800 PMB 245
Round Rock, TX 78664

800-722-1492 (phone)

www.artofmission.com
[EMAIL PROTECTED]



_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to