JS 및 PHP 모두에 수염을 사용하고 있습니다. JS 용 서식 파일을 하나 만들었으므로 이제 PHP에서 해당 서식 파일을 사용하고 싶습니다. 해당 템플릿을 다시 사용할 수 있습니까? JS 템플릿 : 참고로 JS 및 PHP 용 일반 콧수염 서식 파일
는 아래의 코드를 볼<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th class="header">Name</th>
<th class="header">Email ID</th>
<th class="header">Contact Number</th>
<th class="header">Edit</th>
</tr>
</thead>
<tbody>
<div id="eTableList"></div>
<script id="eList" type="text/template">
<tr>
<td>{{name}}</td>
<td>{{email}}</td>
<td>{{contact_number}}</td>
<td><a href="{{id}}">View/Edit</a></td>
</tr>
</script>
</tbody>
</table>
PHP 템플릿 :
<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th class="header">Name</th>
<th class="header">Email ID</th>
<th class="header">Contact Number</th>
<th class="header">Edit</th>
</tr>
</thead>
<tbody id="eTableList">
<tr>
<td>{{name}}</td>
<td>{{email}}</td>
<td>{{contact_number}}</td>
<td><a href="{{id}}">View/Edit</a></td>
</tr>
</tbody>
</table>
모두 템플릿의 출력은 동일하지만, 내 필요에 따라 그들을 호출 오전 PHP 또는 JS 사용.
JS와 PHP 두 가지 호출에 모두 사용할 수있는 위의 두 개의 템플릿 대신 단일 템플릿을 사용하는 방법이 있습니까?
좋아 멋진 ...하지만 어떻게 당신이 볼 수 모두 템플릿 다른 하나는 PHP 용이고 다른 하나는 JS입니다이기 때문에 일반적인 템플릿을 만드는 방법. – Anubhav