Sorry for the stupid request, but I would need a working sample that shows the PHP code needed to call the API, supposing I would like to extract COLUMNA and COLUMNB from table TABLEA.
thanks a lot and compliments for your great module, that adds a lot of possibilities to Drupal
Matteo Ferrari
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | filesview.info | 161 bytes | mandclu |
| #5 | filesview.module.txt | 2.79 KB | mandclu |
Comments
Comment #1
mandclu commentedThat is absolutely not a stupid request. My initial intention was to have a sample module that implements tha API as part of the inital release, but finding the time to do so was proving difficult, so I decided to release it without, with the intention to come back and add the example.
As it is, I'll probably try to base the example on something in core (like files), so that it's easier to try it out and see how it works. Stay tuned, I'll try to get something posted as soon as possible.
Comment #2
mandclu commentedHere is an example that will list files in the site, giving you the option to filter based on a certain MIME type, file size, and so on. It's a pretty simple example at this point, but hopefully it will be a reasonable starting point:
As time goes on I'd like to allow for a callback function on the field, so that the module implementing the API can perform addtitional processing before diplaying it. In this example, it would allow for the display of the nid field, with a callback that might retrieve and display the node's title as a link to view the node.
Note that in the field descriptions I've included fields that aren't intended for diplay (as designated with the 'hidden' parameter). In my modules that implemented the dataview API, I did this to fully support an external data set, so I could import and store the complete data set, but only retrieve and display the appropriate fields.
I'll try to add to this example over time, and will probably include it in a future version of the distribution.
Comment #3
mandclu commentedOK, I've just committed a new dev version that supports a display callback, and will include an examples folder containing the filesview module. It's still a little rough around the edges, but hopefully will give you enough information to get started.
Comment #4
wvd_vegt commentedHi,
If i may add another stupid question, where do i put the script you posted (filename etc).
I installed dataview in the hope i could use it to display user dependent data (grades).
Comment #5
mandclu commentedIt should be put into a module. I tried to include it with the updated distrib, but it didn't seem to pick it up. I'll try to correct that, in the meantime here's the module (it's updated a bit from what I posted before) - I had to add .txt to the name, please remove it before use.
As for using it to display user-dependant data, that should work fine as long as the data itself all resides in one table. You can, however, use a callback function to augment the display of the data. For example, if one field is the uid of the user, you could use a callback to look up the user and diaplay the user name as a link to their profile.
Comment #6
mandclu commented...and a .info file for use with the module.