Forum

Thread tagged as: Events, Gallery

How to output selected gallery on front-end from events ?

I am trying to show the gallery selected in the events app on the front-end but can't get it to output the gallery. I have the dropdown working for albumlist just can't get it album to show.

<perch:content id="album" type="albumlist" label="Album" />
<?php
    $album = perch_content_custom('My region', array('skip-template'=>true));
    if (is_array($album)) {
        // ['album'] is the ID of the field to get the slug from
        $albumSlug = $album[0]['album']; 
        perch_gallery_album($albumSlug);
    }
?>
Adam Beattie

Adam Beattie 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can you post your Diagnostics Report please?

PERCH INFORMATION

Perch: 2.8.31 Production mode: Production (100) Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_gallery (2.8.6), perch_events (1.9.3) DB driver: PDO DB tables: perch2_categories (0), perch2_category_counts (0), perch2_category_sets (0), perch2_content_index (1205), perch2_content_items (49), perch2_content_regions (17), perch2_events (1), perch2_events_categories (0), perch2_events_to_categories (0), perch2_gallery_albums (1), perch2_gallery_image_versions (6), perch2_gallery_images (1), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (6), perch2_resource_log (131), perch2_resource_tags (0), perch2_resources (11), perch2_resources_to_tags (0), perch2_settings (23), perch2_user_passwords (0), perch2_user_privileges (32), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1) Users: 1 App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events', 'perch_gallery', ); Scheduled tasks for perch_events: update_category_counts (60 mins) Editor plug-ins: ckeditor, markitup H1: 421aa90e079fa326b6494f812ad13e79 L1: 5a0ea27ea845aaad74dab56e58acb60b F1: 2edba60ed1f613d6dd804feb202456a2 headerColour: #403f40 content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.8.30: done latest_version: 2.8.15 on_sale_version: 2.8.31 headerScheme: dark dashboard: 0 hide_pwd_reset: 0 content_hideNonEditableRegions: 0 content_frontend_edit: 0 logoPath: /admin/resources/bg-icon.png update_2.8.31: done perch_events_update: 1.8 perch_gallery_update: 2.8.5 perch_events_detail_url: /trips/trip.php?s={eventSlug} perch_gallery_bucket_mode: single perch_gallery_bucket: default perch_gallery_basicUpload: 0 PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: root PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: bg PERCH_DB_PREFIX: perch2_ PERCH_TZ: UTC PERCH_EMAIL_FROM: ciara@lukecreative.co.uk PERCH_EMAIL_FROM_NAME: Ciara Luke PERCH_LOGINPATH: /admin PERCH_PATH: /Users/adambeattie/Downloads/bohemiangetaways.com/admin PERCH_CORE: /Users/adambeattie/Downloads/bohemiangetaways.com/admin/core PERCH_RESFILEPATH: /Users/adambeattie/Downloads/bohemiangetaways.com/admin/resources PERCH_RESPATH: /admin/resources PERCH_HTML5: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /Users/adambeattie/Downloads/bohemiangetaways.com/admin/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SESSION_TIMEOUT_MINS: 20 HOSTING SETTINGS

PHP: 5.6.10 Zend: 2.6.0 OS: Darwin SAPI: apache2handler Safe mode: not detected MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $ MySQL server: 5.5.42 Free disk space: 10.32 GB Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, yaz, mcrypt, gettext, pgsql, pdo_pgsql GD: Yes ImageMagick: No PHP max upload size: 32M PHP max form post size: 32M PHP memory limit: 128M Total max uploadable file size: 32M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes HTTP_HOST: localhost:8888 HTTP_CONNECTION: keep-alive HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 HTTP_REFERER: https://localhost:8888/admin/core/settings/diagnostics/ HTTP_ACCEPT_ENCODING: gzip, deflate, sdch HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8 HTTP_COOKIE: CP.mode=B; size=4; wp-settings-2=libraryContent%3Dbrowse%26posts_list_mode%3Dlist%26mfold%3Do%26editor%3Dtinymce%26hidetb%3D1%26wplink%3D1; wp-settings-time-2=1455748355; _ga=GA1.1.777339527.1439994584; _qst_s=1; wp-settings-1=libraryContent%3Dbrowse%26align%3Dcenter%26urlbutton%3Dnone%26editor%3Dtinymce%26hidetb%3D1%26imgsize%3Dthumbnail%26mfold%3Do; wp-settings-time-1=1457989391; __utma=111872281.777339527.1439994584.1460148883.1460805465.38; __utmz=111872281.1454147917.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); SQLiteManager_currentLangue=2; cmsa=1; __atuvc=0%7C26%2C0%7C27%2C0%7C28%2C0%7C29%2C32%7C30; __atuvs=579a4f37a454850c00c; PHPSESSID=18e51e9defab7d2f88054fda64a9ea6f PATH: /usr/bin:/bin:/usr/sbin:/sbin SERVER_SOFTWARE: Apache/2.2.29 (Unix) mod_wsgi/3.5 Python/2.7.10 PHP/5.6.10 mod_ssl/2.2.29 OpenSSL/0.9.8zg DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.22.0 SERVER_NAME: localhost SERVER_ADDR: ::1 SERVER_PORT: 8888 REMOTE_ADDR: ::1 DOCUMENT_ROOT: /Users/adambeattie/Downloads/bohemiangetaways.com SERVER_ADMIN: you@example.com SCRIPT_FILENAME: /Users/adambeattie/Downloads/bohemiangetaways.com/admin/core/settings/diagnostics/index.php REMOTE_PORT: 50380 GATEWAY_INTERFACE: CGI/1.1 SERVER_PROTOCOL: HTTP/1.1 REQUEST_METHOD: GET QUERY_STRING: extended REQUEST_URI: /admin/core/settings/diagnostics/?extended SCRIPT_NAME: /admin/core/settings/diagnostics/index.php PHP_SELF: /admin/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1469734582.34 REQUEST_TIME: 1469734582 argc: 1

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you checked the value of $albumSlug?

print_r($albumSlug);

Just tried that not printing anything. Think I have this wrong ?

$album = perch_content_custom('My region', array('skip-template'=>true));

I don't have a region set for this, does it not pull out automatically if set in the event.html template ?

thanks for your help.

Have it printing: Array ( [albumSlug] => [_default] => )

ok now have it outputting: Array ( [albumSlug] => thai-yoga-retreat [_default] => thai-yoga-retreat )

Below is the code I am using:

    $album = perch_events_custom(array('skip-template'=>true));
    if (is_array($album)) {
        // ['album'] is the ID of the field to get the slug from
        $albumSlug = $album[0]['album']; 
        perch_gallery_album($albumSlug);
    }
Drew McLellan

Drew McLellan 2638 points
Perch Support

Looks like you need

$albumSlug = $album[0]['album']['ablumSlug'];

wouldn't you say?

With that nothing is printing out now, below is my currant code:

$album = perch_events_custom(array('skip-template'=>true));
if (is_array($album)) {
    // ['album'] is the ID of the field to get the slug from
    $albumSlug = $album[0]['album']['ablumSlug'];
    perch_gallery_album($albumSlug);
}
   print_r($albumSlug);
Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you get from:

 print_r($album);