0

Hi I'm having a parse order issue that I can't seem to figure out.

I have a template that looks like this:

some code here  
<div class="content-line">

    {exp:low_variables:parse var="lv-inner-content"
    preparse:transcribe:language_abbreviation="{transcribe:language_abbreviation}"
    preparse:channel-name="{segment_1}"
    }

</div>
more code here

The Low variable contains the following code

<!-- content inner page -->
<div class="column two-thirds inner-page-content">
{exp:switchee variable = "{segment_2}" parse="inward"}


    {case value="#^P(\d+)$#|''|products"}
    listing page
    {exp:channel:entries channel="{channel-name}" disable="member_data|category_fields" limit="5" paginate="bottom"}
        {exp:ce_img:pair src="{product-photo}" max="125" crop="yes" allow_scale_larger="y" fallback_src="/images/bladder-logo.jpg"}
            <img src="{made}" alt="" width="{width}" height="{height}" />
        {/exp:ce_img:pair}
            <h3><a href="{comment_url_title_auto_path}">{title}</a></h3>
            <p class="post-meta">
                posted on {entry_date format="%F %d"}
            </p>
                {product-content}
                <a href="{comment_url_title_auto_path}" class="read-more">{exp:transcribe:replace name="read-more"}</a>

        <div class="dbl-dott-wrapper"></div>

        {paginate}
        <div class="pager">
        {pagination_links}
            {previous_page}<a href="{pagination_url}" class="pager-previous">Previous</a>
            {/previous_page}

             {!--<a href="#">&laquo;</a> --}

             {page}
             <a href="{pagination_url}" {if current_page}class="active"{/if}>{pagination_page_number}</a> 
             {/page}

             {!--<a href="#">&raquo;</a> --}

             {next_page}
             <a href="{pagination_url}" class="pager-next">Next</a>
             {/next_page}

        {/pagination_links}
        </div>
        {/paginate}

    {/exp:channel:entries}
    {/case}



    {case default="yes"}
    default=yes
    {exp:channel:entries channel="{channel-name}" disable="member_data|category_fields" limit="1"}
        {exp:ce_img:pair src="{product-photo}" max="125" crop="yes" allow_scale_larger="y" fallback_src="/images/person_default.png"}
            <img src="{made}" alt="" width="{width}" height="{height}" />
        {/exp:ce_img:pair}
            <h3>{title}</h3>
            <p class="post-meta">
                posted on {entry_date format="%F %d"}
            </p>

                {product-content}

        <div class="dbl-dott-wrapper"></div>

                        <!-- Comments -->
<h2 class="fs15 col-3e3b3b wei700">Comments</h2>
<div class="separator17"></div>

<div class="comments-list">

    {exp:comment:entries channel="{channel-name}" sort="asc"}
    {if no_results}
    <div class="comment-item">
        <div class="comment-text">
            <p>There are no comments yet, why not be the first to comment?</p>  
        </div>
    </div>
    {/if}


    <div class="comment-item">
        {!--<div class="comment-avatar">
            <img src="images/55x55/comment-avatar.jpg" alt="">
        </div>--}
        <div class="comment-text">
            <div class="comment-info">
                <strong>{url_as_author}</strong>
                <div class="comment-date">{comment_date format="%d %M, %Y %g:%i%A"}</div>
            </div>
            {comment}                       
        </div>
    </div>
    {/exp:comment:entries}
</div>

<!-- end comments -->
<div class="dbl-dott-wrapper"></div>

<div class="leave-comment">
    <h2 class="fs15 col-3e3b3b">Leave a Reply</h2>
    {exp:comment:form channel="{channel-name}"}
        <div class="columns four alpha">
            <label for="name">Name<span class="colored-blue">*</span></label>
            <input type="text" name="name" value="{name}" required>
        </div>
        <div class="columns four">
            <label for="email">Email<span class="colored-blue">*</span></label>
            <input name="email" type="email" value="{email}" required>
        </div>
        <label>Commment<span class="colored-blue">*</span></label>
        <textarea name="comment" cols="100" rows="5" required>{comment}</textarea>
        <span class="btn btn-blue"><input type="submit" value="Post Comment"></span>
    {/exp:comment:form}
</div>
<div class="separator8"></div>
    {/exp:channel:entries}



    {/case}
{/exp:switchee} 
</div>
<!-- /content inner page -->

I need to use this template in a few template groups so have split out the repeated code into a low_variable which should be fine. However it's not working as expected.

Only the single entry page is being displayed when the switchee tags are inside the low variable. When I take the code out of the low variable and put it into the main template everything works as expected.

would really like to keep this as a low variable but I'm not sure what I need to change to get this to work. Have tried turning on/off early parsing with no change.

6
  • Does {segment_2} parse in LV template when put outside the switchee? Just want to make sure the variable is being set.
    – Siebird
    Feb 4, 2013 at 20:58
  • If I copy and paste the lv variables into the main template the switchee parses correctly, but when in the LV template it doesn't.
    – CreateSean
    Feb 4, 2013 at 21:00
  • 1
    What about when you add {segment_2} above the switchee tag in LV template, does it parse?
    – Siebird
    Feb 4, 2013 at 21:11
  • No it does not - thank you. Once I added another preparse to the original template I've got it working. preparse:switchee-var="{segment_2}" and then pass switchee-var to the switchee tag.
    – CreateSean
    Feb 4, 2013 at 21:17
  • 1
    @CreateSean, would you kindly post your answer as an official answer below? Thank you, sir. Oct 26, 2013 at 3:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.