Forumlar / Cotonti / Support / IF/ELSE Statements TPL

Iceman
#1 2014-08-04 17:26

Hello, I am wondering if there is support for elif or elseif statements in the CoTemplate code?

I have modified the attach2 plugin to suit my needs, execpt I can not get this portion of my code to work. Does cotonti support If statements within if statements?

"

<!-- IF {ATTACH_ROW_WEBM} -->
        <source src="{ATTACH_ROW_PATH}" type='video/webm' />
        <!-- ENDIF -->

"

My tpl:

<!-- BEGIN: MAIN -->
<link href="plugins/attach2/lib/lightzap/css/lightzap.css" rel="stylesheet" type="text/css" />
<link href="plugins/attach2/lib/lightzap/css/lz-theme.css" rel="stylesheet" type="text/css" />
<script src="plugins/attach2/lib/lightzap/js/lightzap.js"></script>
<style type="text/css">
.att-gallery { }
.att-gallery .att-item { margin:10px 20px 0 0; height:120px; width:120px; display:block; float:left; }
.att-gallery .att-item img { padding:1px; background:#666; border:2px solid #666; display:block; }
.att-gallery .att-item img:hover {border:2px solid #fff; }
</style>

<div class="att-gallery clearfix">	
	<!-- BEGIN: ATTACH_ROW -->
    	<!-- IF {ATTACH_ROW_VID} -->        
		     <video id="video_player" class="video-js vjs-default-skin" controls preload="none" width="560" height="315"  
      poster="themes/nemesis/img/poster.png"    
      data-setup="{}">
   		<source src="{ATTACH_ROW_PATH}" type='video/mp4' />
        
    	<!-- IF {ATTACH_ROW_WEBM} -->
        <source src="{ATTACH_ROW_PATH}" type='video/webm' />
        <!-- ENDIF -->
    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
  </video>
		<!-- ELSE -->   
       	
            <!-- IF {ATTACH_ROW_IMG} -->
            
                <div class="att-item">
                <a href="{ATTACH_ROW_URL}" data-lightzap="attgal" title="{ATTACH_ROW_TITLE}" ><img src="{ATTACH_ROW_ID|att_thumb($this,100,100,'crop')}" alt="{ATTACH_ROW_FILENAME}" /></a>
                </div>
            
            <!-- ELSE -->
    <table class="cells">     
        <tr>   
            <td class="centerall width25">
                <img src="{ATTACH_ROW_EXT|att_icon($this,48)}" alt="{ATTACH_ROW_EXT}" width="48" height="48" />
            </td>
            <td class="width50">
                <p><a href="{ATTACH_ROW_URL}" title="{ATTACH_ROW_TITLE}">{ATTACH_ROW_FILENAME}</a></p>
                <p class="small">{ATTACH_ROW_SIZE} ({PHP.L.att_downloads}: {ATTACH_ROW_COUNT})</p>
            </td>
            <!-- ENDIF -->
        <!-- ENDIF -->
	</tr>
<!-- END: ATTACH_ROW -->
</table>
</div>
<!-- END: MAIN -->

 

Roffun
#2 2014-08-07 14:25
checking for expansion can be so
 <!-- IF {ATTACH_ROW_EXT} == 'webm' -->

 

Улетел на другую планету, а там почты нету.. https://www.cotonti.com/forums/45298?m=posts
Macik
#3 2014-08-11 00:33
#39655 Iceman:

Does cotonti support If statements within if statements?

Yes, it does. You can use:

<!-- IF {VALUE1} -->
Value1 is set
  <!-- IF {ADDITION_VAR} -->
  Addition var is SET also
  <!-- ELSE -->
  Addition var is NOT set 
  <!-- ENDIF -->
<!-- ENDIF -->

 

 

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F

Bu konu Macik tarafından düzenlendi(2014-08-29 14:21, 9 yıllar önce)
Iceman
#4 2014-08-29 16:31

Thanks for your help. :)