|
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 |
cablehead Smarty Rookie
Joined: 09 Jul 2003 Posts: 23
|
Posted: Wed Jul 09, 2003 6:16 am Post subject: Smarty - Raw Template Readability |
|
|
G'dday,
I'm a new comer to smarty, so I apoligise if this has been asked a million times before. I'm in the middle of evaluating using smarty for a project and was concerned that the templates didn't seem to be very designer friendly. For example, the 'why use smarty' doco has the following template:
Quote: |
<table>
{section name=art loop=$article}
<tr>
<td>{$article[art].headline}<td>
<td>{$article[art].date}<td>
<td>{$article[art].author}<td>
</tr>
{/section}
</table
|
which looks like this when viewed raw by the designer:
Quote: |
{section name=art loop=$article}
{/section}
{$article[art].headline} {$article[art].date} {$article[art].author}
|
I'm happy about seeing {$article ...} in the table cells - that way the designer can get a feel for oh yeah, something will go here - but they shouldn't see {section - because that won't be turning up in the end result. I've noticed that you can use <% or whatever you like to enter smarty command mode. This will have the reverse problem - they won't see the <% section ... but they also won't see <% article .. which means they won't get a feel for something will end up here ...
The ideal would be if there was a way of having some dummy text along side the smarty place holder so they can get used to seeing something similier to what will actually turn up when the page is run ..
Just trying to get a feel for what other people are doing in this area ..
cheers!
Andy. |
|
Back to top |
|
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Thu Jul 10, 2003 2:09 pm Post subject: |
|
|
I think you could do this:
Quote: |
<table>
<!-- {section name=art loop=$article} -->
<tr>
<td>{$article[art].headline}<td>
<td>{$article[art].date}<td>
<td>{$article[art].author}<td>
</tr>
<!-- {/section} -->
</table
|
The comment tags (<!-- & -->) around the section tags will end up in the HTML output, but this is an option. |
|
Back to top |
|
cablehead Smarty Rookie
Joined: 09 Jul 2003 Posts: 23
|
Posted: Thu Jul 10, 2003 5:02 pm Post subject: |
|
|
Thanks for the reply mocean!
That sounds like it would work. It'd be be good though to keep to keep things consistent. Is anything like the following possible?
Quote: |
<table>
<%--section name=art loop=$article--%>
<tr>
<td><%--$article[art].headline}--%>{*Earth women can mate with Martians!*}<td>
<td><%--article[art].date--%>{*20-06-2003*}<td>
<td><%--$article[art].author--%{*Fred Jones*}<td>
</tr>
<%--/section--%>
</table
|
Which should show the following in a wysiwyg editor:
Quote: |
{*Earth women can mate with Martians!*} {*20-06-2003*} {*Fred Jones*}
|
Can you change smarties entry and exit symbols to <%-- & --%> but still get into a smarty comment with {* ?
Thanks!
Andy. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
cablehead Smarty Rookie
Joined: 09 Jul 2003 Posts: 23
|
Posted: Thu Jul 10, 2003 11:33 pm Post subject: |
|
|
Cheers Messju,
Sorry for posting an already solved problem .. should have searched a bit harder ..
Andy. |
|
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
|