0
Smartyテンプレートがあり、現在商品イメージを挿入しています。私がしたいのは、画像のsrcだけを与えるようにそのコードを修正することです。Smartyテンプレートでimg srcを取得する
テンプレートは、ファイル「product_icon.tpl」と私は、これは、そのファイルから該当するコードである集まる何からが含まれています
{capture name="main_icon"}
<a href="{"$product_detail_view_url"|fn_url}">
{include file="common/image.tpl" obj_id=$obj_id_prefix images=$product.main_pair image_width=$settings.Thumbnails.product_lists_thumbnail_width image_height=$settings.Thumbnails.product_lists_thumbnail_height}
</a>
{/capture}
そして、そこに含まれていた「image.tpl」ファイルには、(これを含ま)簡潔にするために関連する部分をトリミング:
{capture name="product_image_object"}
{** Sets image displayed in product list **}
{hook name="products:product_image_object"}
<img class="ty-pict {$valign} {$class} {if $lazy_load}lazyOwl{/if} {if $generate_image}ty-spinner{/if} cm-image" {if $obj_id && !$no_ids}id="det_img_{$obj_id}"{/if} {if $generate_image}data-ca-image-path="{$image_data.image_path}"{/if} {if $lazy_load}data-{/if}src="{if $generate_image}{$images_dir}/icons/spacer.gif{else}{$image_data.image_path}{/if}" alt="{$image_data.alt}" title="{$image_data.alt}" {if $image_onclick}onclick="{$image_onclick}"{/if} {if $image_width || $image_height} style="min-width: {$image_data.width}px; min-height: {$image_data.height}px; "{/if}/>
{if $image_data.alt}<span class="stonestreets-caption">{$image_data.alt}</span>{/if}
{/hook}
{/capture}
は、これらのコードスニペットを合わせ、出力のみにリサイズした画像のSRCを下に簡素化することができますか?あなたはいつもの変数
{$product.main_pair|print_r}
をチェックするために、TPLにprin_rを使用することができます
本当に便利です。しかし、これは私に元のサイズを与えている。サイズ変更された画像へのパスを確認するにはどうすればよいですか? – user500665
申し訳ありませんが、私に何も与えていないのですか? – user500665
$ image_width:$ image_heightを独自の値で変更しましたか? – Hungryweb