Forums / Setup & design / Database Calls & Variables

Database Calls & Variables

Author Message

Alex Jones

Tuesday 02 December 2003 1:06:27 pm

I have some attributes of a class that are displayed multiple times on a page, for example I have a price that is written in at least three different spots on the page. Does eZ publish hit the database for each of these, or are they already set? If they are already set, is there any overhead to calling them repeatedly via a call like {attribute_view_gui attribute=$content_version.data_map.item_1_price} ?

At this point I am playing with the idea of pulling the price once and setting it in a variable for the entire page as I believe that should cut down on calls to MySQL, but I want to ensure my understanding is correct.

So, it boils down to this question: Do I gain any performance improvements by setting 'price1=$node.data_map.item_1_price.data_float' once at the top of the template and then using {$price1} to display the price compared with {attribute_view_gui attribute=$content_version.data_map.item_1_price}?

Any help would be greatly appreciated!

Alex

[Edited after first posting]

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alex Jones

Thursday 04 December 2003 6:22:14 am

Anyone?

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Jan Borsodi

Thursday 04 December 2003 8:02:24 am

You can gain some performance improvement by doing this.
The other benefit is that the template is usually easier to read.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Alex Jones

Thursday 04 December 2003 8:47:49 am

Thanks Jan! I thought it would help, and as you mention it makes the templates much easier to read as I have some complicated section show statements throughout the template.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>