Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

period in field name, how to handle in section?

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
tsmtsm
Smarty n00b


Joined: 24 Mar 2007
Posts: 3

PostPosted: Sat Mar 24, 2007 6:23 pm    Post subject: period in field name, how to handle in section? Reply with quote

Hello fellow smarties,

I tried by myself and also searched here and there but could not find the correct way to do this.

Here's the problem.....
We ve got a Mysql DB Backend with Fieldnames like this "blabla.bla". (In this case the left of the period is not the table name.)
The following code doesn't work because of the "." in the fieldname.

=========================

{section name=data loop=$result}
<tr>
<td scope="col">{$result[data].InfoPolicy.ID}</td>
<td scope="col">{$result[data].InfoPolicy.ObjectID_FK}</td>
<td scope="col">{$result[data].InfoPolicy.IssueDate}</td>
</tr>
{/section}

=========================
I also tried with backticks on the whole resultstring as well as partially... somehow just trying to be lucky with the code:D.

However I couldn't figure it out..
Can anyone help me with this?

Thank you very much.
Back to top
View user's profile Send private message
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Sun Mar 25, 2007 4:29 am    Post subject: Reply with quote

Modify your abstraction layer to rename all column names, replacing . with _

Good luck!
Back to top
View user's profile Send private message Visit poster's website
tsmtsm
Smarty n00b


Joined: 24 Mar 2007
Posts: 3

PostPosted: Sun Mar 25, 2007 6:32 am    Post subject: Reply with quote

toma wrote:
Modify your abstraction layer to rename all column names, replacing . with _

Good luck!


Thank you Toma,

Yes, this was the next thing i was about to do if there would be no solution from within smarty. I wonder though, is there no way to escape it somehow, and pass it on as a fieldname instead of a nested array (as the punctuation suggests) ? I think I will dive into the the secrets of smarty now. Smile

Thank you again Toma
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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