1
jmass
MySQL or Smarty question.
  • 2004/5/27 20:39

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Helo!

I am currently working on a new module. I query the DB and return an array (a single row of the table). How do I pass the individule elements of the array to the smarty template.

In the past I have done multiple querys to the db to retrieve the elements and then passed each one to the smarty template. But I know there has to be a more elegant and better performing solution.

Thanks,

JMass

2
chapi
Re: MySQL or Smarty question.
  • 2004/5/27 20:50

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22


For questions on smarty you should read the manual, which helps in many cases: http://smarty.php.net/manual/en/

A solution for your problem can be found on the following page in the smarty manual: foreach loops.

3
jmass
Re: MySQL or Smarty question.
  • 2004/5/27 21:18

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


I love RTFM responses especialy when they come with the link to the manual. (I am not being sarcastic, i really appreciate it)

Unfortunately that seems to run through the array. I need a way to pick individule elements from the array for display. Maybe I need to break it down it the php page first and then pass the vars seperatly. Any php help in that regard?

JMass

4
Mithrandir
Re: MySQL or Smarty question.

To access an array in Smarty - let's say $list is an array and you want the title element - you write this
<{$list.title}>

5
jmass
Re: MySQL or Smarty question.
  • 2004/5/27 21:47

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


As usual you are the man!

THANKS!

JMass

Login

Who's Online

392 user(s) are online (285 user(s) are browsing Support Forums)


Members: 0


Guests: 392


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits