ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Linking gallery images to separate new pages

February 08, 2012 2:56am

Subscribe [3]
  • #1 / Feb 08, 2012 2:56am

    andy_slick

    22 posts

    Hello All,

    Ok, so I am building a website that has a gallery page. I want the gallery images to be links to an individual page which would have more information on the gallery item. Each of these individual pages has the same template I just need to figure out a way that when the client enters the details for the gallery item the link between that individual page and the gallery will be automatically generated.

    Any thoughts?

  • #2 / Feb 08, 2012 5:02am

    Matt:P

    277 posts

    Hi Andy

    Could you give us an example of the extra information you plan on displaying for each gallery item?

    One option is to create two Channels, one for the Gallery Items and another for each Gallery and use relationships. i.e. a Related Gallery field within the Gallery Item entry.

    The main drawback is that an item will only be allowed to relate to one Gallery (unless you use multiple Relationship Fields within the Gallery Item entry)

    See: http://ellislab.com/expressionengine/user-guide/modules/channel/relationships.html for more info

    Another method which I’ve used makes use of an add-on called Matrix by Pixel and Tonic: http://pixelandtonic.com/matrix

    Using a Matrix Field you can allow more than one image, image caption, image title etc per Entry.

    (http://pixelandtonic.com/matrix/docs/image-galleries)

    Hope it helps

    Matt

  • #3 / Feb 08, 2012 9:33am

    andy_slick

    22 posts

    Thanks Matt,

    I plan on using the Matrix plugin to structure the content on both the gallery page and the item pages.

    What I can’t figure out at the moment is how to make a new URL page be generated as a result of adding a new gallery image.

    Each gallery image needs to have a link to another individual page, which displays a larger picture and some info about the picture.

    Hope that makes sense…

  • #4 / Feb 08, 2012 9:54am

    Matt:P

    277 posts

    OK, I see

    Let’s say your Template that will eventually display the detail is called ‘item’ and is in the gallery Template Group i.e.
    domain.com/gallery/item/

    The next segment of the URL will be the url_title of the gallery entry e.g. pop-art
    domain.com/gallery/item/pop-art

    Now what you have to define is the Row from the Matrix field which will need to be displayed e.g. row 2
    domain.com/gallery/item/pop-art/2

    So the code which generates the link above might look like: (within the usual EE Entries tag)

    {gallery}
       <a href="http://{path=gallery/item/{url_title}/{row_id}}">_     {image_title}_   </a>
    {/gallery}

    Have a look at the Docs for Matrix. There’s a {row_id} tag which you can use in a link: http://pixelandtonic.com/matrix/docs/image-galleries

    Now, in the template…

    In the template “item”, the row_id can also be used as a parameter in the field’s tag-pair e.g. (assuming your matrix field short name is ‘gallery’)

    {exp:channel:entries channel="photo_gallery"}
        {title}
        {gallery row_id="last_segment"}
         <img>
        {/gallery}
    {/exp:channel:entries}
  • #5 / Feb 09, 2012 12:11pm

    Shane Eckert

    7174 posts

    Hello andy_slick,

    It looks like Matt:P is doing an excellent job providing you with some answers.

    Is there anything else you need, and questions that I can answer?

    Cheers,

  • #6 / Feb 11, 2012 11:38pm

    andy_slick

    22 posts

    Cheers for that Matt.

    Just what I needed to know about the path URL works perfect.

    Shane, any thoughts where I can learn about using categories to determine where entries are visible?

    Cheers,

    Andy

  • #7 / Feb 13, 2012 6:03pm

    Sean C. Smith

    3818 posts

    Hi Andy,

    Interestingly just a couple of days ago Mike Boyink posted a new tutorial on categories

    Does that help or do you need something else?

    Sean

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases