Language/EL tag

Twig tag 모음

건담아빠 2022. 9. 2. 13:36

그냥 보면 달 알듯하여 작업된 코드만 추가

{% include "import/common/header.html" with {'is_unified_search': true, 'is_header_cart': true} %}

{% set ezp_navi_title = template_layout.sPageTitle %}
{% if template_layout.aNavList is iterable and template_layout.aNavList|length > 3 and is_full_navigation != true %}
    {% if template_layout.aNavList[2].pageTitle is not empty %}
        {% set ezp_navi_title = template_layout.aNavList[2].pageTitle %}
    {% else %}
        {% set ezp_navi_title = template_layout.aNavList[2].name %}
    {% endif %}
{% endif %}

<div class="content-head">
    <div class="page-title">
        <h3 class="h3-tit">{{ __(ezp_navi_title) }}</h3>
        <!--
        <a href="#" class="btn-manual" target="_blank" title="{{ __('매뉴얼') }}">{{ __('매뉴얼') }}</a>
        -->
        {% if is_unified_search == true %}
            {% include "import/common/unified_search.html" %}
        {% endif %}
    </div>

    <div class="cont-info-right {{ is_header_cart == true ? 'green-caption' : '' }}">
        {% if is_header_cart == true %}
            <div class="breadcrumb-caption">
                <a href="/buyer/cart/front/list?cart_type=10" target="_blank" class="popup">
                    <span>{{ __('장바구니에 담긴 상품을 확인해보세요!') }}</span>
                    <i><img src="/svc/ezpick/ko/img/modal-newwindow-icon.png" alt="modal open icon"></i>
                </a>
            </div>
        {% endif %}
        <ul class="breadcrumb">
            {% if template_layout.aNavList is iterable %}
                {% for idx, nav in template_layout.aNavList %}
                    {% if is_full_navigation == true or idx < 3 %}
                        {% if nav.pageTitle is not empty %}
                            <li>{{ __(nav.pageTitle) }}</li>
                        {% else %}
                            <li>{{ __(nav.name) }}</li>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% endif %}
        </ul>
    </div>
</div>

{% set a_location = { '': __('배송지역 선택') }|merge(aConst.location) %}
 
{{ aSellerBase.shop_name|slice(0, 1) }}

{% set iNum = aListTotal.settlehold_item_count - (aParams.page - 1) * aParams.limit %}
{{ iNum|number_format }}
{% set iNum = iNum - 1 %}

PHP : <?php if ($aRow['is_complete_inspected'] === true) { ?>
TWIG : {% if aRow.is_complete_inspected is same as(true) %}
{% if aRow['is_complete_inspected'] == true %}
  
{{ aRow.arrival_date|date('n/j') }}
  
<form id="frmHistoryBack" name="frmHistoryBack">
    {% for sKey, mVal in aParams %}
        {% if ('pp_' in sKey) == true %}
            {% if mVal is isArray %}
                {% for sSubKey, sSubVal in mVal %}
                    <input type="hidden" id="{{ sKey|replace({'pp_': ''}) }}{{sSubKey}}" name="{{ sKey|replace({'pp_': ''}) }}[{{ sSubKey }}]" value="{{ sSubVal }}"/>
                {% endfor %}
            {% else %}
                    <input type="hidden" id="{{ sKey|replace({'pp_': ''}) }}" name="{{ sKey|replace({'pp_': ''}) }}" value="{{ mVal }}"/>
            {% endif %}
        {% endif %}
    {% endfor %}
</form>
  
{% for sKey, mVal in aParams %}
    {% if ('pp_' in sKey) == true %}
        {% if mVal.count() > 1 %}
            {% for sSubKey, sSubVal in mVal %}
                <input type="hidden" id="{{ sKey|replace({'pp_': ''}) }}{{sSubKey}}" name="{{ sKey|replace({'pp_': ''}) }}[{{ sSubKey }}]" value="{{ sSubVal }}"/>
            {% endfor %}
        {% else %}
                <input type="hidden" id="{{ sKey|replace({'pp_': ''}) }}" name="{{ sKey|replace({'pp_': ''}) }}" value="{{ mVal }}"/>
        {% endif %}
    {% endif %}
 
{% endfor %}

-- substr
{{ aBuyer.corporation_no|slice(0, 6) }}
  
{{ aTagName|join(' ') }}
 
{{ aSellerMarket.market_no in (aParams.market_nos|split(',')) ? 'active' : '' }}
{% if aSellerMarket.market_no in (aParams.market_nos|split(',')) %}active{% endif %}
 
{% if aFilter is not empty and aFilter.aSellerMarketList is not empty %}
    {% for iKey, aSellerMarket in aFilter.aSellerMarketList %}
        <button class="temp-button {{ aSellerMarket.market_no in aParams.market_nos|split(',') ? 'active' : '' }}" data-code="{{ aSellerMarket.market_no }}" data-text="{{ aSellerMarket.market_name }}">{{ aSellerMarket.market_name }}</button>
    {% endfor %}
{% endif %}
 
{% set iMarketAndSellerCount = aParams.market_nos|split(',')|length + aParams.seller_nos|split(',')|length  %}
<li class="active"><a href="#product-filter-tab-con1">마켓/가게 <span>{{ iMarketAndSellerCount > 0 ? ('<span>' ~ iMarketAndSellerCount ~ '</span>') |raw : '' }}</span></a></li>
<li><a href="#product-filter-tab-con2">스타일 {{ aParams.product_styles is not empty ? ('<span>' ~ aParams.product_styles|split(',')|length ~ '</span>') |raw : '' }}</a></li>

https://learntutorials.net/ko/twig/topic/8697/%EA%B8%B0%EB%B3%B8-%ED%85%9C%ED%94%8C%EB%A6%BF-%EA%B5%AC%EB%AC%B8
https://twigfiddle.com/mxwkea
https://ridi.github.io/style-guide/HTML.html

{{ aRow | json_encode(constant('JSON_PRETTY_PRINT')) }}

$twig->addGlobal('SESSION', $_SESSION);
$twig->addGlobal('COOKIE', $_COOKIE);
$twig->addGlobal('SERVER', $_SERVER);
$twig->addGlobal('PARAM', p());
$twig->addGlobal('IMG_EC_CDN_HOST', IMG_EC_CDN_HOST);
 
{{SESSION.shop_admin_id}}
 
{% set array = "3,1,2" %}
{% for current in array %}
    <h1>This is number {{ current }} in the array </h1>
{% endear %}
 
{# 프로퍼티가 여러개일 경우 #}
{% set options = {
    'key_name': key_value,
    'key_name': key_value,
    'key_name': key_value
} %}
   
{# 단일 프로퍼티일 경우 #}
{% set options = {'key_name': key_value} %}
 
 
-- 삼항 연산자
{{ foo ? 'yes' : 'no' }}
{{ foo ?: 'no' }}
{{ foo ? foo : 'no' }}
 
 
{% if aParams.order_no is empty %}
{% elseif aRow.order_type == aConst.order_type_general %}
{% endif %}
 
{{__('결제요청')}}
{{ aTotal.count_pay_status_request|number_format }}
{{__('개')}}
 
 
{{ limit_select|raw }}
{{ pager|raw }}
 
 
{% block pageJs %}
<script type="text/javascript">
    $(document).ready(function () {
        alert('test');
    });
</script>
{% endblock pageJs %}
 
 
{% if template_layout.aCurrentMenu|is_valid_array == true %}
{% endif %}
 
 
<form id="frmSearch" name="frmSearch" action="{{ '/ezpick' ~ url }}">
 
<table>
    <tbody>
    {% if aList is not empty %}
        {% for aRow in aList %}
            {% if aRow.is_add_in == 'T' %}
                <tr class="{{ aRow.is_add_in == 'T' ? 'add-order' : '' }}">
                    <td>
                        <span class="txt-red">{{__('추가')}}<br>{{__('입고')}}</span>
                        {% elseif aRow.order_type == aConst.order_type_general %}
                        <span>{{__('일반')}}<br>{{__('주문')}}</span>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
    {% else %}
        <tr>
            <td colspan="11"><div class="noData"><span class="noimg"></span><p>{{__('등록된 건이 없습니다.')}}</p></div></td>
        </tr>
    {% endif %}
    </tbody>
</table>
{{ pager|raw }}

{% include "import/layer_bad_request.html" %}

 
<div class="product-item {{ aRow.sold_out_class }}">
    <button type="button" name="button" class="btn-like btnPicktem " data-product_no="{{ aRow.product_no }}">픽템추가</button>
    <div class="product-image">
        <a class="eProductDetail" href="/ezpick/product/front/detail?product_no={{ aRow.product_no }}"
           style="background-image: url('{{ aRow.main_img_url }}')"></a>
    </div>
    <div class="item-text">
        <p class="product-text">
            <em><a class="eSellerDetail" href="/ezpick/product/seller/front/index?seller_no={{ aRow.seller_no }}">[{{ aRow.market_name }}] {{ aRow.seller_name }}</a></em>
            <span><a class="eProductDetail" href="/ezpick/product/front/detail?product_no={{ aRow.product_no }}">{{ aRow.product_name }}</a></span>
            <strong>{{ aRow.product_price|number_format }}</strong>
        </p>
        <!--
        <div class="product-option-list">
            <em>분류</em>
            <p><strong>남성</strong><strong>상의</strong><strong>후드</strong></p>
        </div>
        -->
    </div>
    <div class="product-option">
        <!--
        <ul>
            <li class="prd"><em>색상</em><span>화이트</span></li>
            <li class="prd"><em>사이즈</em><span>FREE</span></li>
            <li class="prd"><em>소재</em> <span>겉감 : 면 100%</span></li>
        </ul>
        -->
    </div>
    <div class="product-btn-group">
        <button type="button" name="button" class="btn-picktem btnPicktem " data-product_no="{{ aRow.product_no }}">픽템</button>
        <button type="button" name="button" class="btn-pickshop btnPickSeller " data-seller_no="{{ aRow.seller_no }}">픽샵</button>
    </div>
</div>