I have a module Block No Results which displays the no results data when block has no results. Variable Api if I will use the variable api then I need the 4 variables for a single block to keep the no results data and displays the results. Custom Table If I'll go with custom table then I'll keep the 6 fields in the table.
id - primary key
module - varchar(64)
delta - varchar(32)
status - tinyint(4)
content - longblob
empty_criteria - varchar
UNIQUE KEY md
(module
,delta
)
KEY list
(status
,module
)
Overview On every block view I need to check that whether the block no results criteria is enabled for this block.If it is then I need to check what is the empty criteria and on the basis of that I need to perform action.
Problem Variable api : If I'll use the variable api then on each block view I need to load the variables separately i.e. 5 variables load( ~5 database fetch queries)(if block no results is enabled) and 1 variable load(~1 query)(if block no results is disabled for that block). As the variable api is integrated with the cache api so on the development sites usually get the results from cache.This seems to me not good approach in the case if a site has 100's of blocks.
Custom table Load the whole row using the module & delta and take the appropriate action if needed.
Currently I have implemented this using the variable api. Which approach should I use ? Is there any other better approach then these ? how I can make it more better if you are going to suggest an approach ?