• Resolved Sellrion

    (@sellrion)


    Hello NextGen!

    I’m trying to create my own default-view.php template to display a single gallery. How can I:

    1. get gallery id. Normal ID. Numeric. Not that md5-crap.
    2. get gallery title.
    3. get gallery description
    4. get gallery slug
    5. get gallery creation date or just timestamp.

    I can’t find any coding docs or gallery internal data structures description. There is no any interesting in var_dump($displayed_gallery).

    Thanks a lot for help!

    • This topic was modified 3 years, 7 months ago by Sellrion.
Viewing 1 replies (of 1 total)
  • Benjamin

    (@benjaminowens)

    Hi @sellrion !

    NextGEN 2.0 has been built on a framework that’s a little difficult to work with, the relevant parts of $displayed_gallery can be found in it’s _stdObject attribute. I’ll be working soon on making it much simpler to work with and easy to inspect, but to answer your questions:

    1: NextGEN can display more than one gallery at a time with mixed sorting so in the code side we have “displayed galleries”; you can get that list by accessing $displayed_gallery->container_ids which is an array.

    2, 3, 4, 5: Because of #1 NextGEN’s templates don’t have gallery information beyond their ID. You can retrieve them using NextGEN’s internal API:

    $mapper  = C_Gallery_Mapper::get_instance();
    $gallery = $mapper->find($gallery_id);
    $title = $gallery->title;
    $desc  = $gallery->galdesc;
    $slug  = $gallery->slug;

    Unfortunately we don’t store gallery creation or modification times, there’s no reliable way to get that information. You could maybe check the creation timestamp of the gallery folder on the filesystem but that has complications. I’m sorry I can’t help much there.

    • This reply was modified 3 years, 7 months ago by Benjamin.
Viewing 1 replies (of 1 total)
  • The topic ‘Template raw gallery data’ is closed to new replies.