How to Create a Gallery Page

A forum for Bolt related questions / issues

How to Create a Gallery Page

Postby Stark Raving » Wed Apr 23, 2014 8:04 pm

Hi Bolters,
I'm not sure if I'm barking up the wrong tree, but I want to create a template/twig page to display a gallery of photos/images. But that may not be the best way to do it. I have in mind three or more separate galleries, that will have different images. Has anyone done this? Or created galleries in another way? This twig stuff is a slow learning process for me, so if anyone has an example that I could look at, then I could probably figure things out.
Thank you.
"After I'm dead I would rather have people ask why I have no monument than why I have one." ~ Cato the Elder

"In heaven all the interesting people are missing." ~ Friedrich Nietzsche
User avatar
Stark Raving
Silver Sponsor
 
Posts: 115
Joined: Tue Dec 11, 2007 9:24 pm
Location: Vancouver

Re: How to Create a Gallery Page

Postby isul » Tue Jul 22, 2014 4:48 am

bolt is based of foundation. May be you try this one
http://foundation.zurb.com/docs/components/clearing.html. :)
isul
 
Posts: 13
Joined: Tue Jul 22, 2014 2:32 am

Re: How to Create a Gallery Page

Postby ningus » Tue Jul 22, 2014 1:16 pm

Hi! For me this works:

First make sure to add "imagelist" to your contenttypes.yml for pages:
Code: Select all
        imagelist:
            type: imagelist

Bolt backend will ask you for rebuilding the database. Follow the instructions.

Now create a new page, there will be a new field for adding images to a list, add some images and publish.

Your page does now have a very sparse list of image-thumbnails. To make this more gallery-like, add some code to your record.twig template. Locate the line where the code block for imagelists begins, in base-2014 theme this is line 29. Replace the appropriate lines with this:

Code: Select all
{% elseif record.fieldtype(key) == "imagelist" and value != "" %}

    {# We do something tricky here: we need to get value of the list in the proper
       way, so the value in actually returned as a list. Using {{ record.key }}
       won't work, because there is no value 'key'. In your own templates you
       will be able to use {{ record.yourfieldname }}. #}

    {% set list = attribute(record, key) %}

    <ul>
        {% for item in list %}

        <li class="{% if loop.first %}first {% endif %}{% if loop.last %}last {% endif %}">
            <a class="fancybox" rel="gallery" href="{{ image(item.filename) }}">
                <img src="{{ thumbnail(item.filename, 240,160) }}" alt="{{ item.title }}" title="{{ item.title }}">
            </a>
        </li>

        {% endfor %}
    </ul>


Note: you have to beautify this with css as you like. The first and last list-item will have a specific class, so that you can show first or last images larger than other thumbnails and let them float left or right.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: How to Create a Gallery Page

Postby Stark Raving » Wed Jul 23, 2014 6:08 am

Hey, you guys are stars! Thank you. I will try both ways, as I'm willing to learn as much as I can about Bolt, twig and so on until I fall over unconscious or out of sheer exhaustion. Big hugs!
"After I'm dead I would rather have people ask why I have no monument than why I have one." ~ Cato the Elder

"In heaven all the interesting people are missing." ~ Friedrich Nietzsche
User avatar
Stark Raving
Silver Sponsor
 
Posts: 115
Joined: Tue Dec 11, 2007 9:24 pm
Location: Vancouver

Re: How to Create a Gallery Page

Postby Stark Raving » Sat Jul 26, 2014 3:00 am

Okay. I feel like a twit. However, I did search for photo/image gallery in this forum and found nothing. Today, however, I was browsing through the forum posts page by page, and found this photoalbum extension https://github.com/jadwigo/bolt-photoalbum on Bolt Github. I found it in a post that had no mention of photos or images in the subject line. But here it is. There you are.
"After I'm dead I would rather have people ask why I have no monument than why I have one." ~ Cato the Elder

"In heaven all the interesting people are missing." ~ Friedrich Nietzsche
User avatar
Stark Raving
Silver Sponsor
 
Posts: 115
Joined: Tue Dec 11, 2007 9:24 pm
Location: Vancouver

Re: How to Create a Gallery Page

Postby isul » Tue Aug 05, 2014 10:56 pm

have you succeed with this extention. I have got error alert.
isul
 
Posts: 13
Joined: Tue Jul 22, 2014 2:32 am

Re: How to Create a Gallery Page

Postby Stark Raving » Wed Aug 06, 2014 4:10 pm

No, sorry. I haven't yet tried the extention. When I do, I'll post the results.

Cheers
"After I'm dead I would rather have people ask why I have no monument than why I have one." ~ Cato the Elder

"In heaven all the interesting people are missing." ~ Friedrich Nietzsche
User avatar
Stark Raving
Silver Sponsor
 
Posts: 115
Joined: Tue Dec 11, 2007 9:24 pm
Location: Vancouver

Re: How to Create a Gallery Page

Postby ningus » Wed Aug 06, 2014 6:46 pm

I'm afraid this extension will not work in recent bolt versions, it’s "extension.php" contains these lines:
Code: Select all
'required_bolt_version' => "1.0.2",
'highest_bolt_version' => "1.3",

At least it could be useful as an inspiration for your site’s contenttypes.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: How to Create a Gallery Page

Postby isul » Sat Aug 09, 2014 1:32 am

I tried to make a gallery with "NINGUS WAY" + Clearing Fundation. Here the ling http://isul.web.id/gallery/portfolio
isul
 
Posts: 13
Joined: Tue Jul 22, 2014 2:32 am

Re: How to Create a Gallery Page

Postby ningus » Sat Aug 09, 2014 10:43 am

Hey, isul this looks good, very well done!
Although I feel slightly uncomfortable with my name written in capital letters ;)

One minor thing to improve: when I load your gallery page (browser cache emptied) the first image appears to be positioned off center, the following images are ok, when I go back to first image it is ok either. So it looks like the initial script execution comes a tad to late. You can try to put the foundation script into your templates’ header.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Next

Return to Bolt Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron