[SCMP] Interests - International property

中文版: http://drupaltaiwan.org/forum/20101026/4655

This is actually not the first project I build for SCMP
But it will be a good summary for my works on Drupal for first half of 2010

Site structure

  1. 3 level navigation – frontpage, taxonomy(countries), articles
  2. 5 content types:
    1. articles
    2. featured content
    3. images in gallery
    4. static page
    5. useful resources

Frontpage structure

Frontpage is build within one views, which contain 5 main parts (display)

  1. views::attachment Featured
  • a maximum of 5 images rotation
  • use jQuery Galleriffic plugin
  • content type featured content
  • views::attachment Sponsored
    • sponsored articles
  • views::page Recent
    • recent uploaded articles
  • views::attachment Gallery
    • All content “images”
    • Upon click, larger image appears (by fancybox)
  • views::attachment more
    • list of all articles in the site
    • order by regions of articles
    • complex views templates (remark1)

    Technical highlights

    • Images in gallery as a standalone content type
    • Every image have several size to display, extensive use of imagefield, imagefield_crop, imagecache
    • Articles need to link the images to itself to display images in gallery section
    • Single image can be reused over articles
    • In image popup, “related articles” can be show if another article also use this image (remark2)

    Remark1: complex views templates


    • Articles will be unpublished/published on scheduled date
    • Country list is dynamic, only display a country if the country have a published article belongs to
    • The display is 3 column, with dynamic number of rows, as the number of displayed country is dynamic
    • The country list is ordered by country name

    SQL through views (simplified sample):

    •  SELECT country_name, node_title FROM `nodes` JOIN taxonomy WHERE nodes.tid = taxonomy.tid GROUP BY country_name ORDER BY country_name;

    Result set will be like:

    • Canada, title1
    • Canada, title2
    • China, title3
    • France, title4
    • USA, title5


    • number of country in each column (2,1,1)
    • count current country
    • print country name when needed
    • open/close a column when needed

    Remarks2: related articles of images

    • A views that take the image node id as argument
    • And find articles that node reference is image node id
    • If second argument is given, remove second argument from result set, so in article page, “related articles” do not show itself