Howdy,
I’m using some Jquery scripts and am trying to do some slickness with my portfolio pieces on a redesign of my site.
The page in question is here.
Now, you can see what I’m attempting to do below…here are the basic rules I’m trying to code against:
1. I want 8 entries to show up on my main portfolio page, across any category (newest 8 entries). This I have achieved.
2. I need every 4th entry to get an additional class appended in the style sheet. This is a layout rule. I have achieved this, but I’m not sure if my implementation is going to work as the number of entries goes above 8. I used this to address this layout rule:
<div class="galleryImage {if {count} == "4" OR {count} == "8"}alt{/if}">. Any suggestions about how to dynamically do this without hard coding every 4th post would be great.
3. At the end of my 8 entries, I would have this code occur to end a page of portfolio and start the sliding jquery script to show the next page:
<div class="clear"></div>
</div><!-- end slide -->
<div class="slide">I have pretty much achieved this, but again, not sure how elegant my solution is.
Now, here’s where things get screwy: After my 8th post, I want to start a whole new div (see code below) I want to show 8 MORE portfolio pieces, and then start another div. Each time I start a new div, that’ll give me a new page using the slider and I can limit the portfolio to 8 pieces per page, and allow the next page to self populate with whatever posts didn’t show up on the first page, second page, and so on.
My conditional
{if {count} > 7}is creating a kind of endless loop and repeats my conditional code over and over, creating new pages with each loop. Not what I want. This is because I have more than 7 posts overall. I think I’m essentially using the wrong conditional to check against and it’s writing my div over and over before filling it with 8 entries.
My code is below, and if you visit the link above, the first page you hit demonstrates what I want, and then on the next page, I want the same type of thing, only with other portfolio pieces, all of which are arranged by date.
Hope this is clear. It’s probably simpler than I’m making it. Thanks in advance.
<div class="slide">
{exp:weblog:entries weblog="webportfolio" orderby="date" sort="desc" limit="8"}
<div class="galleryImage {if {count} == "4" OR {count} == "8"}alt{/if}">
{exp:imgsizer:size src="{webthumb}" width="195" height="195" alt="{title} by Gino Guarnere" title="{title}" /}
<a href="http://{fullimage}" rel="fancybox" class="zoomButton fancyboxImage"></a>
<a href="http://{path=spotlight/description/{entry_id}}" class="descriptionButton fancyboxDescription"></a>
</div>
{!-- experiment --}
{if {count} > 7}
{!-- issue is with the if statement above. since you have more than 8 posts, it keeps iterating the loop below, and every time it repeats this block of code and creates more "slides" instead of grouping everything together --}
<!-- the count is greater than 8 -->
<div class="clear"></div>
</div><!-- end slide -->
<div class="slide">
<div class="galleryImage {if {count} == "12" OR {count} == "16"}alt{/if}">
{exp:imgsizer:size src="{webthumb}" width="195" height="195" alt="{title} by Gino Guarnere" title="{title}" /}
<a href="http://{fullimage}" rel="fancybox" class="zoomButton fancyboxImage"></a>
<a href="http://{path=spotlight/description/{entry_id}}" class="descriptionButton fancyboxDescription"></a>
</div>
<!-- this is a loop -->
{/if}
{!-- end experiments --}
{/exp:weblog:entries}
{!-- close weblog entries code goes here if things need to be reverted --}
<!-- if statement ends here -->
{!-- this clears the first loop below so you need it --}
<div class="clear"></div>
</div><!-- end slide -->