|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kjarli Smarty Rookie
Joined: 07 May 2007 Posts: 11
|
Posted: Thu Jul 26, 2007 1:43 pm Post subject: Organising html with {include} is hard |
|
|
My source is a little messed up if you look at it.
I use tabs to organise my html.
But when i use {include}, it just pastes in the include.
It would be much nicer if each line of html would get the same tabs in front of it as the include has.
lets say 4 spaces is 1 tab:
Code: |
header.tpl
<div>
<table>
<tr>
<td>some text</td>
</tr>
</table>
</div>
body.tpl
<div>
<table>
<tr>
<td>{include file='header.tpl'}</td>
</tr>
</table>
</div>
|
Lets say we print this
this would output
Code: |
<div>
<table>
<tr>
<td><div>
<table>
<tr>
<td>some text</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
|
While it would be nicer to display:
But when i use {include}, it just pastes in the include.
It would be much nicer if each line of html would get the same tabs in front of it as the include has.
lets say 4 spaces is 1 tab:
Code: |
header.tpl
<div>
<table>
<tr>
<td>some text</td>
</tr>
</table>
</div>
body.tpl
<div>
<table>
<tr>
<td>{include file='header.tpl'}</td>
</tr>
</table>
</div>
|
Lets say we print this
this would output
Code: |
<div>
<table>
<tr>
<td>
<div>
<table>
<tr>
<td>some text</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
|
|
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Thu Jul 26, 2007 2:23 pm Post subject: |
|
|
Just use {strip} and you don't have anymore problems with your intentations SCNR
I don't know a quick solution to your problem. I guess you'd have to hack the part of the Smarty compiler that executes the inclusion. I have no knowledge of the include part of the compiler, so I won't be able to help you with this one. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Jul 26, 2007 5:08 pm Post subject: |
|
|
If you really want to force some pretty printing of the HTML, I suggest you do so using the PHP tidy extension within an output filter. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|