2013-11-20 5 views
0

CMSMS를 처음 사용하고 이전 버전을 고통스러운 업그레이드 경로로 가져 와서 현재 버전으로 가져 왔습니다. 주요 변경 사항 중 하나는 Smarty 3을 템플릿 엔진으로 사용하는 것입니다. 이 변경으로 기존 템플릿 몇 개가 손상되었습니다.SmartM 템플릿으로 CMSMadeSimple 업그레이드 - 예기치 않은 속성

관련 CMSMS 모듈은 "Calguys 모듈 확장"의 일부가 여기에

내가지고있어 오류 메시지입니다처럼 보인다 "제품 및 재고 관리자"라고 : 여기
Syntax Error in template "module_db_tpl:ProductsWithLocation;summary_default" on line 26 "<h2 style="float:left;margin-right:10px;color:"#fff">{$products_path_names.$key parent=$tmp|ltrim:'-1'}</h2>" unexpected "parent" attribute 

전체의 템플릿을 던지고 그 : 오류가 발생한 경우

{if !isset($items)} 
    {cgerror}<h2>Sorry! There is No material matched the query</h2>{/cgerror} 
<p>Please try browsing our <a href="metarial-index">"full catalog" </a>here. </p> 
{else} 



{if empty($products_path_names)} 


{assign var='products_pagelimit' value=$actionparams.pagelimit|default:'25'} 
{assign var='products_parent' value=$actionparams.hierarchyid|default:$actionparams.parent} 
{assign var='products_hier_info' value=$ProductsWithLocation->GetHierarchyInfo($products_parent)} 
{assign var='products_path_ids' value='.'|explode:$products_hier_info.hierarchy} 
{assign var='products_path_names' value=' | '|explode:$products_hier_info.long_name} 


{if !empty($products_parent) }<div style="overflow:hidden"> 
<h2 style="float:left;margin-right:10px">Browsing </h2> 
{foreach from=$products_path_ids key='key' item='tmp' } 
{if !$smarty.foreach.default.last} 
{module_action_link module='ProductsWithLocation' action='hierarchy' text=$products_path_names.$key page=$page_alias parent=$tmp|ltrim:'0' pagelimit=$products_pagelimit} 

{else} 

<h2 style="float:left;margin-right:10px;color:"#fff">{$products_path_names.$key parent=$tmp|ltrim:'-1'}</h2> 

{/if} 




{/foreach}<h2 style="float:left"> Colors...</h2></div> 

{/if} 


{/if} 


<div id="status-bar" 

{if isset($pagecount) && $pagecount gt 1} 
<span class="page-text">{$curpage} {$oftext} {$pagecount} {$pagetext} </span> 
<ul class="paging"> 
<li>{$firstlink}</li><li>{$prevlink}</li> <li>{$nextlink}</li><li>{$lastlink}</li></ul> 
{/if} 

<a href="#" class="switch_thumb">Switch Thumb</a> 

{if $products_parent !=13 } 

<a class="a-z" href="{$products_path_names.$key}_Index.htm">{$products_path_names.$key}</a> 
{else} 

{/if} 



</div> 

<ul class="gallery"> 

{foreach from=$items item=entry} 


    {* 
    the summary template has access to custom fields via the $entry->fields hash 
    and to categories via the $entry->categories array of objects. Also 
    attribute information is available via $entry->attributes. 
    you should use the get_template_vars and the print_r modifier to see 
    what is available 
    *} 

    {if $products_parent == 13 } 

    <li> 




    <dl> 
    <dt><a class="tip_trigger more-stone-info" href="{$entry->detail_url}">{$entry->product_name}<span class="tip">More information about <strong style="color:#9BD8EB">{$entry->product_name}</strong></span></a></dt> 
{* accessing all of the fields in a list *} 
{if isset($entry->fields)} 

    {foreach from=$entry->fields key='name' item='field'} 
    {if isset($field->value)} 
     {if $field->type == 'checkbox' or $field->type == 'image' && isset($field->thumbnail)} 
    {else} 


{/if} 


{if $field->type == 'image' && isset($field->thumbnail)} 
<a href="{$entry->detail_url}" class="tip_trigger thumb product_pre"><span class="tip">More information about <strong style="color:#9BD8EB">{$entry->product_name}</strong></span><img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}"/></a> 
{/if} 
    {/if} 
    {/foreach} 
{/if} 
{assign var='hinfo' value=$ProductsWithLocation->GetHierarchyInfo($entry->hierarchy_id)} 

<dd><em>Stone Type: </em>Cambria Quartz</dd> 
<dd><em>Collection: </em>{module_action_link module=ProductsWithLocation action=default hierarchyid=$entry->hierarchy_id text=$hinfo.name}</dd> 

</dl> 


    </li> 


{else} 

<li> 




    <dl> 
    <dt><a class="tip_trigger more-stone-info" href="{$entry->detail_url}">{$entry->product_name}<span class="tip">More information about <strong style="color:#9BD8EB">{$entry->product_name}</strong></span></a></dt> 
{* accessing all of the fields in a list *} 
{if isset($entry->fields)} 

    {foreach from=$entry->fields key='name' item='field'} 
    {if isset($field->value) && $field->name != 'GalleryFolder'} 
     {if $field->type == 'checkbox' or $field->type == 'image' && isset($field->thumbnail)} 
    {else} 
<dd><em> 
{$name} 
</em> 

     {if is_array($field->value)} 
     {if !empty($field->value) } 

     {foreach from=$field->value item='val'} 
      {if $field->type == 'image' && isset($field->thumbnail)} 
     {else} 

      {module_action_link module=$mod->GetName() action=default fieldid=$field->id fieldval=$val text=$val} {/if} 
     {/foreach} 
     {/if} 
     {else} 
{if $field->type == 'image' && isset($field->thumbnail)} 
     {else} 
     {module_action_link module=$mod->GetName() action=default fieldid=$field->id fieldval=$field->value text=$field->value} {/if} 
     {/if} 

</dd> 

{/if} 


{if $field->type == 'image' && isset($field->thumbnail)} 
<a href="{$entry->detail_url}" class="tip_trigger thumb product_pre"><span class="tip">More information about <strong style="color:#9BD8EB">{$entry->product_name}</strong></span><img src="{$entry->file_location}/{$field->thumbnail}" alt="{$field->value}"/></a> 
{/if} 
    {/if} 
    {/foreach} 
{/if} 
{assign var='hinfo' value=$ProductsWithLocation->GetHierarchyInfo($entry->hierarchy_id)} 
<dd><em>Stone Type: </em>{module_action_link module=ProductsWithLocation action=default hierarchyid=$entry->hierarchy_id text=$hinfo.name}</dd> 

</dl> 


    </li> 

{/if} 


{/foreach} 
</ul>{/if} 

여기에 해당 템플릿 관련 싹둑입니다 :

{$products_path_names.$key parent=$tmp|ltrim:'-1'}</h2> 

우리가 알고있는 바로는 데이터베이스에있는 제품을 기반으로 이름을 가진 사용자 지정 함수를 호출하는 것입니다. 우리는 기대하지 않는 속성 "부모"를 보내고 있습니다. 그 속성을 제거하면 에러는 사라지지만 출력은 이상하게됩니다.

마술 총알이 부족합니다.이 기능을 정의 할 수있는 곳을 찾는 데 도움이 될 것 같아요. 나는 또한 ltrim ("- 1")로 보이는 것을 사용함으로써 당황 스럽습니다. 그래서 그것의 어떤 설명도 좋을 것입니다. 어쩌면 함수 호출을 수정하기 위해 블록을 if 블록으로 대체 할 수 있습니까?

편집 - 다음은 변수에 대한 몇 가지 샘플 값을이다 :

$ products_path_names $ 키 문자열을 보유하고 '화강암'

가 tmp에 문자열을 00017

감사를 보유 $.!

답변

0

나는 다소 풀었다. 나는 전적으로 부모의 속성을 제거하고이 라인을 변경하여 이상한 출력을 고정있어 :

{if !$smarty.foreach.default.last} 

그것은 거짓으로 빈 문자열을 계산하지 않은

{if $smarty.foreach.default.last != ''} 

에.

이제 작동합니다.