Forums / Developer / Calling PHP methods from a template

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Calling PHP methods from a template

Author Message

Mike Makris

Wednesday 13 October 2010 1:06:10 pm

I am trying to call a php method from a template in order to query the database and return an array. The parameter I pass is the ID of a ContentObject and I query for a set that is external to the Exponential data.

My problem is that the ID I pass gets truncated to the first digit. Also, if i return a count of my result set, that number also gets truncated back in the template. Why is this happening? How do I fix it?

Finally, how do I return the array of records back into the template to print them out with a foreach loop?

Thank you

Mike

MikeM

Thiago Campos Viana

Wednesday 13 October 2010 1:24:51 pm

You could create a custom fetch function, there's a tutorial about that: Understanding and developing fetch functions

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br