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.

Change from thumbnail to full size photo

April 29, 2010 9:03pm

Subscribe [2]
  • #1 / Apr 29, 2010 9:03pm

    marvmax

    13 posts

    I’m still new to EE but what I would like to do is to put a thumbnail on the synopsis page and then when the user goes to the article itself the thumbnail becomes the full sized picture.  I’ve been thinking about it and I know how I would do it with a different language. 

    If synopsis only
        open thumb nail
    elseif body
        open main picture
    end

    I’m hoping for a hint here because I just don’t know enough about the abilities of EE.  I know they’re great and awesome and I love it, but I’m just not sure where to go on this one.

  • #2 / Apr 29, 2010 10:19pm

    John St-Amand

    865 posts

    If you’re using separate templates for the synopsis and article body, you’re work is pretty easy and only slightly tougher if you’re planning to use the same template for both.

    In the former, you’d simply have different parameters and variables specified in the weblog:entries tag. So in the listing template wherein you would have the synopsis of several articles listed, for example, chronologically by entry date with the most recent at the top, you would pull your summary and thumbnail into the template.  In the “details” template you would pull in the body and full image (not to mention whatever other fields you deem appropriate).

    In the latter, you could accomplish what you’re looking to do, at least generally, using conditionals as you have suggested.  Only it would be conditions around segments rather than body versus synopsis.  When you’re using the same template to serve two purposes, you still have to give EE a way to tell which purpose is active at which time.  An easy-ish way to do this is the use segments.  So when you’re using your index template in your blog section, for example, the URL would look like this:

    http://www.my-domain.com/index.php/blog/

    And so in that template, you would have a weblog:entries tag, pulling content from your “blog” weblog.

    {exp:weblog:entries weblog="blog" orderby="date" sort="desc" limit="10" disable="trackbacks|member_data|categories"}

    {title}

    {summary}

    {/exp:weblog:entries}

    </code></pre>

    And since the link is not pointing to a new template, but instead pointing at itself, you could add a conditional that says if you are displaying the article, which would be the url title added to the end of the address and therefore occupying, in this example anyway, segment 2, show the full article, and if not, show the abstract - and when displaying the item by url title, it will only show the one article, whereas without that limitation, it would show all articles in that weblog meeting your other parameter values:

    {exp:weblog:entries weblog="blog" orderby="date" sort="desc" limit="10" disable="trackbacks|member_data|categories"}
    
    {if segment_2="{url_title}"}
    
    <h2><a href="http://{homepage}/blog/{url_title}">{title}</a></h2>
    
    <p>{site_url}/images/uploads/fullsize_image.jpg</p>
    
    <p>{body}</p>
    
    <p> </p>
    
    <p>{if:else}</p>
    
    <h2><a href="http://{homepage}/blog/{url_title}">{title}</a></h2>
    
    <p>{site_url}/images/uploads/thumb_image.jpg</p>
    
    <p>{summary}</p>
    
    <p>{/if}</p>
    
    <p>{/exp:weblog:entries}

    That’s a simplified example, but it should give you the idea.  I generally use a separate template for listing view versus individual entry view, if only because i find it easier to organize my thoughts that way and there are other benefits that are a bit useful too.  But it can be done in either fashion.

    The caveat - I’m only 8 months into my EE life, so there may be better ways to think about this than I’m proposing here - but I’ve made out ok with this approach.  I’d definitely recommend going through Michael Boyink’s free tutorials at www.train-ee.com and if you can swing it, his paid screencasts are a bargain too.  I learned a ton very quickly from him, and from the community in the forum.

    Hope this helps.

    Cheers,
    John

  • #3 / Apr 29, 2010 11:22pm

    marvmax

    13 posts

    Thanks John;
    Your description actually got my mind unlimbered.  Although I didn’t use your solution it did get me thinking and I was able to solve my problem.  Especially your statement that it was easy if you use different templates, which I do.

    So here is what I did.  I’m using EE 2 which has the ability to have a field that is a file.  So I added to fields one called thumb, and one called photo then on the page that displays the synopsis I added this code.

    {if thumb != "" }
         {thumb}{synopsis}
    {if:else}
        {synopsis}
    {/if}

    Then on the page that displays the actual blog I added this code.

    {if photo != "" }
        {photo}{synopsis}
        {body}
    {if:else}
        {synopsis}
        {body}
    {/if}

    Thanks for the help.  This is embarassing but I’ve been using EE about as long as you have.  I worked through the Train-EE site as well and I learned a ton as well.  When I learned that 2.0 was coming I didn’t finish with the site.  I bought the book “ExpressionEngine 2” by Ryan Irelan and it’s great as well.  However, I’ve obviously not learned anywhere near as much as you have.

    Thanks for the help.

  • #4 / Apr 29, 2010 11:28pm

    John St-Amand

    865 posts

    Yep that’s consistent with what I was saying.  Definitely better to use a separate template for list versus full display in my view.  It’s just easier to get your head around and the template tends to be cleaner.  Glad to hear you have it figured out.

    I’m still running into plenty I can’t figure out how to do - often seemly simple little things - but one day and one project at a time I’m getting more comfortable.  The biggest thing for me is getting over the fear of the freedom the flexibility of EE offers.  Kind of overwhelming on my first few projects but I’m settling into a groove now.  It sure makes selling an EE site easier compared to tools i used before this.

    I haven’t yet used EE2 and I’ve been eager to do so. I’m kind of thinking i might use it when i redo my own site, but I’ve been getting so comfortable with 1.6.9 it may feel a bit odd to make the switch.  How have you found it?  Did you get into 1.6.8 much before holding off for 2?

  • #5 / Apr 29, 2010 11:39pm

    marvmax

    13 posts

    Well I’m just a dabbler with EE.  I only use it to create a family web site whenever I can grab a spare minute so it can be hard to really dig in and find solutions on my own.  So I’m jealous of people who get to use EE to make a living.  But this is a very helpful community and they’re amazingly helpful.

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

ExpressionEngine News!

#eecms, #events, #releases