Current location: Hot Scripts Forums » Programming Languages » PHP » smarty & classes


smarty & classes

Reply
  #1 (permalink)  
Old 03-25-08, 02:19 PM
blinn_shade's Avatar
blinn_shade blinn_shade is offline
Aspiring Coder
 
Join Date: Aug 2007
Posts: 540
Thanks: 0
Thanked 0 Times in 0 Posts
smarty & classes

I have this coding:

Code:
{class_name->function name="item[$contents[cont].id]"}
$contents is an array which contains an id.

The thing is this is returning item[Array.id] as the name.

If I just display the $contents[cont].id normally it shows th id. How can this be resolved?

This is smarty's template engine btw.
__________________
Can you think outside the box but remain inside the box?
Reply With Quote
  #2 (permalink)  
Old 03-26-08, 03:49 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Try:
Code:
{class_name->function name="item[$contents.cont.id]"}
Reply With Quote
  #3 (permalink)  
Old 03-26-08, 02:31 PM
blinn_shade's Avatar
blinn_shade blinn_shade is offline
Aspiring Coder
 
Join Date: Aug 2007
Posts: 540
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks but with that it is returning Array.cont.id now.
__________________
Can you think outside the box but remain inside the box?
Reply With Quote
  #4 (permalink)  
Old 04-17-08, 10:27 AM
blinn_shade's Avatar
blinn_shade blinn_shade is offline
Aspiring Coder
 
Join Date: Aug 2007
Posts: 540
Thanks: 0
Thanked 0 Times in 0 Posts
Is there a solution to this?
__________________
Can you think outside the box but remain inside the box?
Reply With Quote
  #5 (permalink)  
Old 04-17-08, 11:21 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Hmm, not sure if it's gonna work, but try:
Code:
{class_name->function name="item[`$contents.cont.id`]"}
Reply With Quote
  #6 (permalink)  
Old 04-17-08, 11:55 AM
blinn_shade's Avatar
blinn_shade blinn_shade is offline
Aspiring Coder
 
Join Date: Aug 2007
Posts: 540
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Nico but no luck. I think it could be an issue with the smarty engine not letting you put [] inside an class element. I have sorted this a completely different way now but supplying the total "name" through an outside array.
__________________
Can you think outside the box but remain inside the box?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Girl with no clue!!!!Booking Classes PHPMYSQL jobless1 Script Requests 0 07-13-07 03:56 AM
converting smarty to html or other useable lang... pkcidstudio PHP 1 05-12-06 02:18 PM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
To Smarty or not to Smarty. That is the question. howman PHP 7 05-23-05 03:57 PM
eMailing Smarty Templates bilco105 PHP 3 01-01-05 11:56 AM


All times are GMT -5. The time now is 07:39 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.