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.

EE2.x: Can’t get my template to do 2 things at once. Advice?

September 05, 2010 6:30pm

Subscribe [4]
  • #1 / Sep 05, 2010 6:30pm

    roryrabbitfield

    320 posts

    I want my template to show:
    1. Left side: a grid of thumbnails that are drawn from a channel, and use the pagination tag to group the thumbnails into groups of x images. You click the pagination links to move from one group of thumbs to another, while staying in the same template. You click the thumbnail itself to make the right side “single entry” area change to the relevant entry, while staying in the same group of thumbnails.
    2. Right side: A “single entry” type display of a product.

    The problem: If you click a thumbnail, the resulting page does show the new product on the right, but the only thumb that shows up in the left is the one for that one new product. I guess this is because the url_title in the URI is limited what the tag will grab. I had intended for the thumbs to be a way for you to move around in the products.

    Here’s my code for #1 left side:

    <div id="product_thumbs_grid">
    {exp:channel:entries channel="collection" orderby="jewelry_reorder" sort="asc"}
    <a href="http://{path=/collection/{url_title}}">{jewelry_photo}</a>
    {paginate}{if total_pages > 1}
    {pagination_links}
    {/if}{/paginate}
    {/exp:channel:entries}

    </div><!—end div product_thumbs_grid—>

    Here’s my code for #2 right side:

    <div id="product_detail_info">
    {exp:channel:entries channel="collection" limit="1" disable="member_data"}
    {jewelry_photo}
    
    <b>{title}</b>
    
    {jewelry_description}
    
    
    {if logged_in}${price}{/if}
    
    
    <a href="http://tray.html%22class=%22droid" class="droid font14 borderButton">ADD TO TRAY</a>
    {/exp:channel:entries}
    </div><!-- end div product_detail_info -->

    What can I do to get the desired effect? Do I need PHP? Javascript? an iFrame?
    Thanks,
    Rory

    Moved to CodeShare Corner by Moderator

  • #2 / Sep 06, 2010 3:36am

    John Henry Donovan

    12339 posts

    Rory,

    Moving to CodeShare Corner as more appropriate here.

    First off add the dynamic=“no” to your thumbnails. That will stop only one showing after you click it.

    {exp:channel:entries channel="collection" orderby="jewelry_reorder" sort="asc" dynamic="no"}

    For the right side try adding the url_title= parameter

    {exp:channel:entries channel="collection" limit="1" disable="member_data" url_title="{segment_3}"}

    Does that help?

  • #3 / Sep 06, 2010 4:30pm

    roryrabbitfield

    320 posts

    Hi John,

    OK, I did those 2 things. I am still having pretty big problems. Here’s my current code:

    
    
    

    I am happy to post the URL here so you can see the real site, but I’d want to be able to get rid of that once we resolve the issue since that will show in in Google searches, making my client unhappy. Will that be possible? How do other people deal with this issue?

    Here’s what’s wrong:

    When I mouse over the “2” link in pagination here is the URL:
    http://www.mysite.com/collection/P2

    But when I click on it, I get the same 2 thumbs, not the 2 next ones. The URL does change to the above URL. If I click on the “2” link again, I get:
    http://www.mysite.com/collection/P2/P2
    ... and the detail info disappears on the right.

    Going back to the beginning, before I’ve clicked on a pagination link: We are on this URL:
    http://www.mysite.com/collection/
    If I click on a thumb (the 2nd one) I do get that product showing up in the detail area at right. But then, the URL of the “page 2” link on the resulting page is:
    http://www.mysite.com/collection/blossom_necklace/P2

    which is not right; it should not have the url_title in segment_2. Right? This is a mess and I have no clue how to fix! Thanks in advance again.

  • #4 / Sep 07, 2010 12:34am

    Rory, you can add this in your header to ensure that Google won’t follow the pages:

    <meta name=“robots” content=“noindex”>

    This looks like an issue with .htaccess, since I don’t see an “index.php”. Are you using NSM .htaccess to do it?

  • #5 / Sep 07, 2010 12:42am

    roryrabbitfield

    320 posts

    Regarding the meta tag to prevent Google from following my pages, Since I have to remove this code when I launch, won’t the “robots” just pick up the link in the forums after I do that?

    Regading .htaccess: I don’t know what NSM is. I am using .htaccess to remove index.php from my URLs. Why would this cause a problem? What can I do to solve it?

    This is what I have in my .htacess doc now:

    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php
    
    # Remove index.php from URLs using include method
    RewriteEngine on 
    RewriteCond $1 ^(weblog|member|search|Forum_Name|home|includes|jewelry|collection|temp_page|contact|about|where_to_buy|members|one_of_a_kind|printable_catalog|P[0-9]{2,8}) [NC] 
    RewriteRule ^(.*)$ /index.php/$1 [L]

    Please tell me what else you would like to know about my site/code in order to get an answer about how to get this to work; many thanks in advance.

  • #6 / Sep 07, 2010 1:58am

    Mike Mella

    178 posts

    Hi Rory.

    I could be wrong, but it seems to me that the thumbnails part of your page requires pagination in your URLs, while the product part of your page requires single-entry titles in your URLs.  Essentially, both of them need to have “dynamic” on, but they each need to be seeing something different in the URLs to produce what you want.  I can’t see how that could work. 

    I’m not sure how you could solve it…How about fetching all 10 product images on a page - the same way the thumbs get fetched - but hiding them all with jQuery until a thumbnail is clicked, which would reveal only that one? 

    Maybe I’m misunderstanding.  Plus it’s late here, so perhaps I’m not thinking straight! 

    In any case, good luck with it.

  • #7 / Sep 07, 2010 4:41pm

    roryrabbitfield

    320 posts

    Mike, I think you might be right about the 2 things needing the URLs to do different things at the same time. Would it work to use an iFrame? I am not so good at javascript, but I can whip up an iFrame. If anyone has any advice, please shout it out. Thx.

  • #8 / Sep 07, 2010 4:50pm

    Mike Mella

    178 posts

    Not sure about the iFrame, as I don’t use those much anymore.  Give it a shot.

  • #9 / Dec 19, 2011 12:52pm

    matyus

    6 posts

    @roryrabbitfield, I seem to have fallen into the exact same situation and can’t seem to figure out the best solution? Can you offer any advice about how you solved this one? Did you end up using iFrames?

  • #10 / Jan 08, 2012 10:57pm

    roryrabbitfield

    320 posts

    Sorry for the delay in response. We used Javascript to show the thumbnails in groups of 9. So really EE was bringing in all the thumbs, and then creating a javascript-based system of showing them 9 by 9. Hope that helps. I didn’t write the javascript so I can’t explain it much more.

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

ExpressionEngine News!

#eecms, #events, #releases