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

Smarty - Raw Template Readability

 
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 -> General
View previous topic :: View next topic  
Author Message
cablehead
Smarty Rookie


Joined: 09 Jul 2003
Posts: 23

PostPosted: Wed Jul 09, 2003 6:16 am    Post subject: Smarty - Raw Template Readability Reply with quote

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
View user's profile Send private message Send e-mail
mocean
Smarty Rookie


Joined: 21 May 2003
Posts: 30
Location: The Netherlands

PostPosted: Thu Jul 10, 2003 2:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
cablehead
Smarty Rookie


Joined: 09 Jul 2003
Posts: 23

PostPosted: Thu Jul 10, 2003 5:02 pm    Post subject: Reply with quote

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


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Jul 10, 2003 6:04 pm    Post subject: Reply with quote

sth. like that was discussed here:
http://www.phpinsider.com/smarty-forum/viewtopic.php?p=1246#1246

it's possible with a smarty-plugin, but not with smarty alone.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cablehead
Smarty Rookie


Joined: 09 Jul 2003
Posts: 23

PostPosted: Thu Jul 10, 2003 11:33 pm    Post subject: Reply with quote

Cheers Messju,

Sorry for posting an already solved problem .. should have searched a bit harder Smile ..

Andy.
Back to top
View user's profile Send private message Send e-mail
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 -> General 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