1

I'm making my first Drupal Module, and I'm just looking for some tips/direction for development.

The module will parse a JSON feed and simply show each object in a formatted way as a simple page. I plan to expand this to be much more modular (including writing to a database table) in the future when time permits.

The "page" display will be something like: - Thumbnails for each different object within the JSON feed - Each thumbnail will have a small thumbnail image, title, and teaser (short description) - Each thumbnail will be clickable - Clicking a thumbnail will produce a lightbox (Lightbox2 or Colorbox) style pop-up with more information for that specific object - Information inside the pop-up should be full description, various other images, etc. - I suppose that each thumbnail will be around 280x320px (though I may want to administer the size of this)

Currently I am able to parse the JSON feed and get the data that I want using: $json = drupal_http_request($url) then $data = drupal_json_decode($json->data). After this I can simply create a string that I can use for the output to 'page_callback' in the hook_menu().

However for returning the output, should I just return one large string that gets printed to the page? or is there a better way?

  • Hello, and welcome to DA! :) Your question is to localized, as it will not be useful to future visitors of the site. Please try breaking it down into several smaller ones. Search the site, and post new questions of those parts that you cannot already find. – Letharion Nov 26 '12 at 15:45
  • Yep, it's quite localized :( I think for the moment I will just end up making a simple 'page' module... then expand it later on when time permits, I'll try to delocalize the question now :) – dan2k3k4 Nov 26 '12 at 15:47
  • You may want to look at something like the Feeds module. If you have the code already for your basic module look into returning a "render array" from the page callback. Also, figure out a way to use drupals cache_set() and cache_get() for already fetched json urls ... – tenken Nov 26 '12 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.