CSCart自定义块模板

时间:2014-11-07 05:40:16

标签: javascript block cs-cart

我正在尝试在cscart上将标签与template/blocks/product_templates/default_template.tpl分开。我的目标是在上面和下面有两个模板:default_template.tpl并为标签添加自定义块。我用Smarty创建了一个自定义HTML。这是代码块:

{capture name="val_hide_form"}{/capture}
{capture name="val_capture_options_vs_qty"}{/capture}
{capture name="val_capture_buttons"}{/capture}
{capture name="val_no_ajax"}{/capture}

{include file="views/tabs/components/product_popup_tabs.tpl"}
{$smarty.capture.popupsbox_content nofilter}

{include file="views/tabs/components/product_tabs.tpl"}

{if $blocks.$tabs_block_id.properties.wrapper}
    {include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
{else}
    {$smarty.capture.tabsbox_content nofilter}
{/if}

它提取HTML,但它无法识别Javascript。

1 个答案:

答案 0 :(得分:0)

您可以尝试在文件default_template.tpl

中的捕获变量中添加选项卡
{capture name="product_details_tabs"}
...
{/capture}

并在自定义html smarty块中显示它(但如果在主要内容块下则需要)

{$smarty.capture.product_details_tabs nofilter}

布局块应该看起来像这样

layout blocks should be looking like this

default_template.tpl文件中的捕获示例:

{if $show_product_tabs}

    {include file="views/tabs/components/product_tabs.tpl"}

    {if $blocks.$tabs_block_id.properties.wrapper}
        {include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
    {else}
        {$smarty.capture.tabsbox_content nofilter}
    {/if}

{/if}

之后

{if $show_product_tabs}

{capture name="product_details_tabs"}

    {include file="views/tabs/components/product_tabs.tpl"}

    {if $blocks.$tabs_block_id.properties.wrapper}
        {include file=$blocks.$tabs_block_id.properties.wrapper content=$smarty.capture.tabsbox_content title=$blocks.$tabs_block_id.description}
    {else}
        {$smarty.capture.tabsbox_content nofilter}
    {/if}

{/capture}

{/if}

我希望有所帮助,