Gallery Single page doesn't work

Permalink Browser Info Environment
Hi again,

I have a question. I won't call it a support request, because I don't plan to use Gallery Single Page ATM, but I'm curious how it all shall work. So, on my site, Gallery single page doesn't show the gallery. I mean when I go to <mySiteURL>/gallery?id=<fileSetID>, my theme layout is displayed, but there is no gallery inside.

I presume that's because I have a page template called "gallery" (so I have gallery.php in my theme folder), and it is loaded instead of the single page installed by Gallery ES (although its controller still works). Is my assumption correct? If yes, how would have I worked around that?

Also, I have a multilingual site, with two content sections. How would have I set up two single page galleries - like, /en/gallery and /de/gallery? Because for each content section, there can be different sets of galleries, with titles in corresponding languages; and the gallery page itself also should have a title in corresponding language. Is it really possible with Gallery ES?

And finally, another reason I choose not to use the single page is because I want to achieve the following. I have a gallery root page, underneath which I have pages with Gallery block placed on them. So the gallery root page should display the list of galleries contained on their child pages. As that is not possible with Gallery ES natively, I went ahead and wrote a custom template for Page List block, which goes approximately like this:

<?
// thumbnail size
$thumbWidth = 1000;
$thumbHeight = 1000;
foreach ($pages as $page) {
  $title = $th->entities($page->getCollectionName());
  $url = $nh->getLinkToCollection($page);
  $imgThumbSrc = false;
  $blocks = $page->getBlocks('Single Gallery');
  if ($blocks) {
    $bGallery = $blocks[0];
    $bGallery = $blocks[0]->getInstance();
    // find out the fileset specified in the block
    $fileSetID = $bGallery->get('fsID');
    $fileset = FileSet::getByID($fileSetID);


It works exactly as I need. However, I had to borrow some of your code for correct processing of main file set image thumbnail, because I don't know how to reference/call your galleryAssist functions from another block template. If that's possible, could you please teach me how? Thanks again in advance for your invaluable help!

Type: Discussion
Status: Resolved
snobo
View Replies:
emirii replied on at Permalink Reply
emirii
Hello!

Yes, if you have a single page gallery.php in your theme it is overwriting the galleryES single page. The safest update-safe method of doing this is something like this in your gallery.php override to include the main gallery code:

<?php 
   //include galleryES gallery core code
   include_once(dirname(__FILE__) . '/../../../' . DIRNAME_PACKAGES . '/gallery_e_s/single_pages/gallery.php'); 
?>


If it gives you a file doesn't exist error, just double check the path.

As far as the dual language, that is definitely a head scratcher. I have really never looked at the mutli-language feature. However I do have an idea. You can make your own single pages based off of the one single page in the package...
application/single_pages/gallery_en
application/single_pages/gallery_de

So that you can create 2 different custom views in your theme, so instead of just gallery.php you'd make a gallery_en and gallery_de so that you can have different titles for each of the pages. You'd have to customize the links to the galleries though, instead of just going /gallery it would be /gallery_de and gallery_en. There is a method in C5 to get the currently selected language code. That might be a little time consuming.
When you create these to your site you have to add them manually by going to "dashboard/pages/single" and typing in "gallery_en" & "gallery_de" in the add single page box.

I'm not sure that's what you're going for, but maybe it will give you some ideas.

GalleryES is also translatable, some research on how to translate sections of the add on is necessary though, it might include the text you're hoping to translate.http://legacy-documentation.concrete5.org/tutorials/translate-your-...

I'm not sure how helpful I can be with the language department...

As for the gallery assist, you can use the gallery assist like this in your code.. as far as the assets and css you might have to load in a controller, or include it manually.

$galleryAssist = new \Concrete\Package\GalleryES\Src\GalleryAssist\GalleryAssist;
//asset include might have to be loaded in the controller
$galleryAssist->registerAssets(1234); //as long as its unique id
$galleryAssist->requireCss(1234, '?bID=1234&crop=0&imageSpacing=0&columns=4'); //the id and css settings, you can customize
//can be loaded in  view
$img = $galleryAssist->getImageProperties($file, 0)
//$file is the file object form C5, 2nd param is watermark is if to display the watermarked version of the thumbnails


$img should have these properties:
$img['thumb'] = thumbnail to use with C5 thumbnail helper
$img['path'] = direct path to file
$img['title'] = title of image
$img['alt'] = description of image
$img['caption'] = galleryES caption
$img['adult'] = is adult


Thank you very much for your review!

concrete5 Environment Information

# concrete5 Version
Core Version - 5.7.5.6
Version Installed - 5.7.5.6
Database Version - 20151221000000

# concrete5 Packages
ExchangeCore Dev Tools (1.0.0), GalleryES (2.5.0), Page Child Redirect (0.9.1), Page Selector Attribute (2.0).

# concrete5 Overrides
blocks/switch_language/view.php, blocks/switch_language, blocks/autonav/templates, blocks/autonav, blocks/gallery_e_s_gallery/view-willnotwork.php, blocks/gallery_e_s_gallery, blocks/page_list/templates/news_list_ajax/view.php, blocks/page_list/templates/news_list_ajax/view.css, blocks/page_list/templates/news_list_ajax/view.js, blocks/page_list/templates/news_list_ajax, blocks/page_list/templates/gallery-list.php, blocks/page_list/templates, blocks/page_list/view.php, blocks/page_list/typical-item-list.inc.tpl, blocks/page_list/controller.php, blocks/page_list, blocks/application_form/add.php, blocks/application_form/edit-form.php, blocks/application_form/edit.php, blocks/application_form/view.php, blocks/application_form/icon.png, blocks/application_form/db.xml, blocks/application_form/view.js, blocks/application_form/mail.tpl, blocks/application_form/controller.php, blocks/application_form, blocks/content/view.php, blocks/content, authentication/concrete/form.php, authentication/concrete, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/site/gsw_CH.po, languages/site/de_CH.po, languages/site/gsw_CH.mo, languages/site/de_CH.mo, languages/site, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_CH/LC_MESSAGES/messages.mo, languages/de_CH/LC_MESSAGES, languages/de_CH, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/gsw_CH/LC_MESSAGES/messages.mo, languages/gsw_CH/LC_MESSAGES, languages/gsw_CH, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, themes/bron/gallery_single.php, themes/bron/teacher.php, themes/bron/calendar_article.php, themes/bron/default.php, themes/bron/templates/news-list.inc.tpl, themes/bron/templates/gallery-single.inc.tpl, themes/bron/templates/gallery-list.inc.tpl, themes/bron/templates/teachers.inc.tpl, themes/bron/templates/article.inc.tpl, themes/bron/templates/layout.tpl, themes/bron/templates/generic-page-list.inc.tpl, themes/bron/templates/teacher-list.inc.tpl, themes/bron/templates/masterclass.inc.tpl, themes/bron/templates/contacts.inc.tpl, themes/bron/templates, themes/bron/news.php, themes/bron/css/_size_tablet_land.scss, themes/bron/css/_size_tablet.scss, themes/bron/css/_grid.scss, themes/bron/css/_size_tablet_port.scss, themes/bron/css/bron-ie8.css, themes/bron/css/_form.scss, themes/bron/css/_config.scss, themes/bron/css/_c5_fixes.scss, themes/bron/css/bron.scss, themes/bron/css/_size_mobile_port.scss, themes/bron/css/bron-ie8.scss, themes/bron/css/_size_960up.scss, themes/bron/css/_define_grid_tablet.scss, themes/bron/css/bron.css, themes/bron/css/_navigation_responsive.scss, themes/bron/css/_size_desktop.scss, themes/bron/css/_base.scss, themes/bron/css/_size_mobile_land.scss, themes/bron/css/_normalize.scss, themes/bron/css, themes/bron/calendar.php, themes/bron/teachers.php, themes/bron/description.txt, themes/bron/page_theme.php, themes/bron/thumbnail.png, themes/bron/pic/default_page_image.jpg, themes/bron/pic/logo-school.svg, themes/bron/pic/admin_background.jpg, themes/bron/pic/nota.svg, themes/bron/pic, themes/bron/page_not_found.php, themes/bron/news_article.php, themes/bron/gallery.php, themes/bron/press.php, themes/bron/bron.js, themes/bron/masterclass.php, themes/bron/press_article.php, themes/bron/article.php, themes/bron/contacts.php, themes/bron, blocks/switch_language/view.php, blocks/switch_language, blocks/autonav/templates, blocks/autonav, blocks/gallery_e_s_gallery/view-willnotwork.php, blocks/gallery_e_s_gallery, blocks/page_list/templates/news_list_ajax/view.php, blocks/page_list/templates/news_list_ajax/view.css, blocks/page_list/templates/news_list_ajax/view.js, blocks/page_list/templates/news_list_ajax, blocks/page_list/templates/gallery-list.php, blocks/page_list/templates, blocks/page_list/view.php, blocks/page_list/typical-item-list.inc.tpl, blocks/page_list/controller.php, blocks/page_list, blocks/application_form/add.php, blocks/application_form/edit-form.php, blocks/application_form/edit.php, blocks/application_form/view.php, blocks/application_form/icon.png, blocks/application_form/db.xml, blocks/application_form/view.js, blocks/application_form/mail.tpl, blocks/application_form/controller.php, blocks/application_form, blocks/content/view.php, blocks/content, authentication/concrete/form.php, authentication/concrete, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/site/gsw_CH.po, languages/site/de_CH.po, languages/site/gsw_CH.mo, languages/site/de_CH.mo, languages/site, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/fr_FR/LC_MESSAGES/messages.mo, languages/fr_FR/LC_MESSAGES, languages/fr_FR, languages/pl_PL/LC_MESSAGES/messages.mo, languages/pl_PL/LC_MESSAGES, languages/pl_PL, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/de_CH/LC_MESSAGES/messages.mo, languages/de_CH/LC_MESSAGES, languages/de_CH, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/tr_TR/LC_MESSAGES/messages.mo, languages/tr_TR/LC_MESSAGES, languages/tr_TR, languages/gsw_CH/LC_MESSAGES/messages.mo, languages/gsw_CH/LC_MESSAGES, languages/gsw_CH, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, themes/bron/gallery_single.php, themes/bron/teacher.php, themes/bron/calendar_article.php, themes/bron/default.php, themes/bron/templates/news-list.inc.tpl, themes/bron/templates/gallery-single.inc.tpl, themes/bron/templates/gallery-list.inc.tpl, themes/bron/templates/teachers.inc.tpl, themes/bron/templates/article.inc.tpl, themes/bron/templates/layout.tpl, themes/bron/templates/generic-page-list.inc.tpl, themes/bron/templates/teacher-list.inc.tpl, themes/bron/templates/masterclass.inc.tpl, themes/bron/templates/contacts.inc.tpl, themes/bron/templates, themes/bron/news.php, themes/bron/css/_size_tablet_land.scss, themes/bron/css/_size_tablet.scss, themes/bron/css/_grid.scss, themes/bron/css/_size_tablet_port.scss, themes/bron/css/bron-ie8.css, themes/bron/css/_form.scss, themes/bron/css/_config.scss, themes/bron/css/_c5_fixes.scss, themes/bron/css/bron.scss, themes/bron/css/_size_mobile_port.scss, themes/bron/css/bron-ie8.scss, themes/bron/css/_size_960up.scss, themes/bron/css/_define_grid_tablet.scss, themes/bron/css/bron.css, themes/bron/css/_navigation_responsive.scss, themes/bron/css/_size_desktop.scss, themes/bron/css/_base.scss, themes/bron/css/_size_mobile_land.scss, themes/bron/css/_normalize.scss, themes/bron/css, themes/bron/calendar.php, themes/bron/teachers.php, themes/bron/description.txt, themes/bron/page_theme.php, themes/bron/thumbnail.png, themes/bron/pic/default_page_image.jpg, themes/bron/pic/logo-school.svg, themes/bron/pic/admin_background.jpg, themes/bron/pic/nota.svg, themes/bron/pic, themes/bron/page_not_found.php, themes/bron/news_article.php, themes/bron/gallery.php, themes/bron/press.php, themes/bron/bron.js, themes/bron/masterclass.php, themes/bron/press_article.php, themes/bron/article.php, themes/bron/contacts.php, themes/bron

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
nginx/1.9.14

# Server API
fpm-fcgi

# PHP Version
5.6.20

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, geoip, gettext, hash, iconv, imagick, intl, json, libxml, mbstring, mcrypt, memcache, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, session, shmop, SimpleXML, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xdebug, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 512M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 250M
memcache.max_failover_attempts - 20
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 1440
xdebug.max_nesting_level - 100
xdebug.max_stack_frames - -1
xdebug.var_display_max_children - 128
xdebug.var_display_max_data - 512
xdebug.var_display_max_depth - 2
opcache.max_accelerated_files - 4000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.