Forums / Developer / Calling PHP methods from a template

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 ezpublish 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