Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Displaying Multiple values in {includes}

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jcx1028
Smarty Rookie


Joined: 13 Apr 2012
Posts: 12

PostPosted: Tue Apr 09, 2013 7:01 pm    Post subject: Displaying Multiple values in {includes} Reply with quote

The Featured Vehicles box on our automotive website uses the following code to display selected vehicles...

Code:
{include file='blocks'|cat:$smarty.const.RL_DS|cat:'featured.tpl' listings=$featured_listings_2 type='listings' field='condition' value='2'}


Because of that value='2', though, this box only displays used vehicles. Is there any way to make it display new vehicles (value='1') as well?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Apr 09, 2013 7:37 pm    Post subject: Reply with quote

Why do you not modify your included template to display both for value='3' ?
Back to top
View user's profile Send private message
jcx1028
Smarty Rookie


Joined: 13 Apr 2012
Posts: 12

PostPosted: Tue Apr 09, 2013 8:26 pm    Post subject: Reply with quote

Not exactly sure where or how I would do that. Here's the featured.tpl file that is referenced in the Featured Vehicles box. Is there something in here that I could change to make this work?

Code:
<!-- featured vehicles block --> 
{assign var='page_key' value=$listing_types.$type.Page_key} 
{if !empty($listings)}    
    <ul class="featured{if !$listing_types.$type.Photo} lalign{/if}{if !$listing_types.$type.Photo} list{/if}">     
        {foreach from=$listings item='featured_listing' key='key'}       
            <li class="item" id="fli_{$featured_listing.ID}">          
            <div class="featured-vehicle">             
                {if $listing_types.$type.Photo}                
                {if $listing_types.$type.Page}<a {if $config.featured_new_window}target="_blank"{/if} href="{$rlBase}{if $config.mod_rewrite}{$pages.$page_key}/{$featured_listing.Path}/{str2path string=$featured_listing.listing_title}-{$featured_listing.ID}.html{else}?page={$pages.$page_key}&amp;id={$featured_listing.ID}{/if}">{/if}
                <img alt="{$featured_listing.listing_title}" title="{$featured_listing.listing_title}" src="{if empty($featured_listing.Main_photo)}{$rlTplBase}img/no-picture.jpg{else}{$smarty.const.RL_URL_HOME}files/{$featured_listing.Main_photo}{/if}" style="width: 280px;height: 210px;" />    
                {if $listing_types.$type.Page}</a>{/if}
                {/if}       
                {assign var='available_field' value=1}
                <ul>
                    {foreach from=$featured_listing.fields item='item' key='field' name='fieldsF'}
                        {if !empty($item.value) && $item.Details_page}
                    <li id="flf_{$featured_listing.ID}_{$item.Key}" {if $available_field == 1}class="first"{/if} {if $listing_types.$type.Photo}style="width: 280px;"{/if}>                
                        {if $available_field == 1}       
                        {if !$listing_types.$type.Photo}<img alt="" class="point" src="{$rlTplBase}img/blank.gif" />{/if}
                        {if $listing_types.$type.Page}<a {if $config.featured_new_window}target="_blank"{/if} href="{$rlBase}{if $config.mod_rewrite}{$pages.$page_key}/{$featured_listing.Path}/{str2path string=$featured_listing.listing_title}-{$featured_listing.ID}.html{else}?page={$pages.$page_key}&amp;id={$featured_listing.ID}{/if}">{else}<b>{/if}                
                         {$item.value}       
                            {if $listing_types.$type.Page}</a>{else}</b>{/if}             
                        {else}          
                            {$item.value}                
                        {/if}                
                    </li>                
                    {assign var='available_field' value=$available_field+1}
                {/if}
                {/foreach}
            {if $available_field == 1}<li></li>{/if}
            </ul>
            </div>
</li>
{/foreach}
</ul>
{else}
    {if $listing_types.$type.Page}
        {if $config.mod_rewrite}
        {assign var='href' value=$rlBase|cat:$pages.add_listing|cat:'.html'}
        {else}
        {assign var='href' value=$rlBase|cat:'?page='|cat:$pages.add_listing}    
        {/if}    
        {assign var='link' value='<a href="'|cat:$href|cat:'">$1</a>'}
        {$lang.no_listings_here|regex_replace:'/\[(.+)\]/':$link}
        {else}    
        {$lang.no_listings_here_submit_deny}
    {/if}
{/if} 
<!-- featured vehicles block end -->
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Apr 09, 2013 9:47 pm    Post subject: Reply with quote

In your first post you said that the behaviour is controlled by value '1' or '2'.

Your template source does not use the 'value' parameter at all.

So I have no idea where you could look. Sorry
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP