Gallery3:Architecture:Data - Gallery Codex
Personal tools

Gallery3:Architecture:Data

From Gallery Codex

Revision as of 09:13, 11 October 2010 by Dmolavi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Contents

Introduction

In G3, during processing, many data items are available.

For item and user, you have access to everything that's in its database table.

For instance, to see the complete current list of available variables in an item object you can do:

   mysql -uroot -e "describe items" g3dev

Here is a list of available data in the current (25 Nov, 2008) G3 development build:

Common variables on album and photo pages:

  • $item: a photo or album
    • type: currently only "album" or "photo")
    • title:
    • description:
    • name: the name of the photo file or album dir
    • mime_type
    • left, right: (internal) used for MPTT tree management
    • parent: the parent item, eg: $theme->item()->parent()->title
    • level: (internal) how far down in the tree this item is
    • width, height: dims of original image, null for albums
    • thumbnail_width, thumbnail_height: dims of thumbnail
    • resize_width, resize_height: dims of resize
    • owner: a user, eg: $theme->item()->owner()->id
  • $children: an array of photos and albums to display
  • $parents: an array of the parents of this item, in order
  • $theme: the theme class
  • url($path): return url to a file, relative to current theme
  • item(): return current item
  • display($file): find and include "$file.php"
  • pager(): print out a pagination bar (eg first/prev/next/last)

     <insertion points>: listed in my other email

  • $user
    • name: login name eg "joe"
    • display_name: full name eg "Joe Smith"
    • password: hashed password
    • login_count
    • last_login
    • email
  • Album page:
  • $page_size: number of elements to show on the page
advertisements