I'm developing a module that is based upon a jQuery plugin that I have previously created.

The plugin displays all data contained within a json record. The module queries a table and retrieves all the data, converts it to a json record and send the record to the plugin to display in a block.

I would like to give the website developer the ability to display a specific record (or set of records) based upon the url (or node id).

So instead of querying all records, I want to add a 'where' clause to the select statement.

I can add a field to the table that groups the records accordingly, but I don't know the best way to display this option to the site developer.

I think that adding a group field based upon the url is perhaps the best approach, but is inefficient because this may require querying the database multiple times. I would have to query the table to find all records that match this group (url) - and if no records exist, then I would query again to select all records.

So what is the best approach?

Thanks.

Les.

Comments

kuldip zala’s picture

Hi,

You can write PHP code under visibility settings.
You will find visibility setting in block configuration page or you can write logic in your custom module under hook_block().

Thanks,
Kuldip Zala

lesgreen’s picture

I assumed that I would create the logic under the hook_block(), but I don't know which is the right approach.

The site developer may want to display all records on a page (in the block), but on certain pages, they may only want to display single record.

I can add a grouping field when the site developer creates the record(s), but how would they add the grouping to the page/block?

I guess the question that I am asking is how do I add context to the view of a module without using CCK? And I think that I need more than just a general suggestion - I need a specific approach. Is there another module that I can look at that does something similar?

Thanks,
Les