Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Organising html with {include} is hard

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
kjarli
Smarty Rookie


Joined: 07 May 2007
Posts: 11

PostPosted: Thu Jul 26, 2007 1:43 pm    Post subject: Organising html with {include} is hard Reply with quote

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
View user's profile Send private message
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Thu Jul 26, 2007 2:23 pm    Post subject: Reply with quote

Just use {strip} and you don't have anymore problems with your intentations Twisted Evil 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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Jul 26, 2007 5:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP