?
Solved

how do i use if loop in smarty template file?

Posted on 2009-04-27
2
Medium Priority
?
499 Views
Last Modified: 2012-05-06
want to display different div based n iteration, below code is not working. its just load first div,
want to load first div when the first iteration and 3,6,9,12, etc.. tanks.
{if count($doc_list) gt 4}
								<div class="insidediv">
								{php}$k=0;{/php}
								{section name=i loop=$doc_list start=4}
									
										{if ($k==0) or ($k%3==0)}
											<div class="addbox1">		
										{else}
											<div class="addbox">
										{/if}
									
									
										Data will be displayed here
									</div>
									{php}$k++;{/php}
								{/section}	
								</div>
								{/if}

Open in new window

0
Comment
Question by:penuel
1 Comment
 
LVL 3

Accepted Solution

by:
joshianurag earned 80 total points
ID: 24248115
Replace

{if ($k==0) or ($k%3==0)}
                                                                                        <div class="addbox1">          
                                                                                {else}
                                                                                        <div class="addbox">
                                                                                {/if}

WITH

{php} if (($k==0) or ($k%3==0)){{/php}
                                                                                        <div class="addbox1">          
                                                                                {php}else{/php}
                                                                                        <div class="addbox">
                                                                                {php}}{{/php}
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question