例如现在我有:
<textarea style='width:100%;height:300px' id='default_file' readonly="readonly">
{$defaultFileContents[0]|escape} // smarty code
</textarea>
但是,我希望它显示等效于(例如单击“下一步”按钮时):
<textarea style='width:100%;height:300px' id='default_file' readonly="readonly">
{$defaultFileContents[1]|escape} // smarty code
</textarea>
并带有索引 2、3、4 等。
$defaultFileContents 是从 PHP 脚本中检索的字符串数组。
编辑:
{literal}
<script language="javascript" type="text/javascript" src="modules/Yastt/views/tpls/editarea/edit_area/edit_area_full.js"></script>
<script language="javascript" type="text/javascript">
editAreaLoader.init({
id : "default_file" // textarea id
,syntax: "{/literal}{$fileType}{literal}" // syntax to be uses for highgliting
,start_highlight: true // to display with highlight mode on start-up
,allow_toggle: true
,is_editable:false
});
editAreaLoader.init({
id : "translated_file" // textarea id
,syntax: "{/literal}{$fileType}{literal}" // syntax to be uses for highgliting
,start_highlight: true // to display with highlight mode on start-up
,allow_toggle: true
});
{/literal}
</script>
<table><tr><td colspan='2'>
<div style='font-size:18px;font-weight:bold;'>File Edit ({$defaultLang} To {$translatedLang})
</div>
</td></tr>
<tr><td>
<div style='font-size:18px;font-weight:bold;'>{$file}</div>
</td></tr></table>
<textarea style='width:100%;height:300px' id='default_file'>
{$defaultFileContents[0]|escape}
</textarea>
<form method='POST' name='FileEdit' action='index.php'>
<input type='hidden' name='module' value='Yastt'>
<input type='hidden' name='action' value='saveraw'>
<input type='hidden' name='lang' value='{$translatedLang}'>
<input type='hidden' name='file' value='{$file}'>
<input type='submit' value='Save'>
<input type='button' value='Cancel' onclick='document.location.href="index.php?module=Yastt&action=overview&lang={$translatedLang}"'>
<input type='button' value='Copy From Above' onclick='document.getElementById("translated_file").value = decodeURIComponent("{$defaultFileContents[0]|escape:'url'}");'>
<textarea style='width:100%;height:500px' name='rawfile' id='translated_file'>
{$translatedFileContents|escape}
</textarea>
</form>
<br>
</form>
您将如何修改此 tpl 代码?