The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Outputting in multiple rows but with pagenav as well ??
I have a table for data items, cars stored in the database.
I want to have a page which lists all the cars stored in the database ( thumbnails of the cars ). How am I to go about outputting them in a single page, in rows of 5 thumbnails, for a total of 4 rows ( ie. 20 per page ) and then have page navigation ( ie. each page has 20 thumbnails ). How do I go about limiting the sql queries in this case ? The hack I am working on is based on magnus's vgarage. The current code now stands at : PHP Code:
|
#2
|
||||
|
||||
The latestbits template looks like this :
PHP Code:
|
#3
|
||||
|
||||
So right now I have uploaded 6 cars with their respective images, however it starts to show in one whole row ( since per page is set to 20 ).
I would prefer it to show as 5 cars in a first row and 1 in a 2nd row. |
#4
|
||||
|
||||
A quick reminder first.
globalize() automatically casts the variables you pass it with the type from the keyword. e.g. PHP Code:
The following chunk of code is from my vBulletin Member Album hack. It has a page browse system, and also sorting options, like DESC or ASC, by username, etc. You should be able to use this script as a guideline for making yours work: PHP Code:
Use the $perpage and $pertr variables to control how many images are shown per page, and how many of that page are shown per row. I use the following template with vB conditionals to show the images. album_image_list HTML Code:
<if condition="$rows"> <if condition="$count == 1"> <tr> </if> <if condition="$image"> <td width="25%" class="<if condition="$count%2 == 0">alt1<else />alt2</if>" valign="top"> <table cellspacing="0" cellpadding="0" width="100%"> <tr> <td valign="top" style="width: 1px; padding-left: 20px"><a href="member.php?$session[sessionurl]u=$image[userid]"><img src="./image.php?u=$image[userid]&type=pthumb" border="0" /></a></td> <td valign="top" style="padding-left: 20px"><a style="font-size:14pt" href="member.php?$session[sessionurl]u=$image[userid]">$image[musername]</a><br /><span class="smallfont">$image[usertitle]<br /><br /><i>$image[comment]</i></span></td> </tr> </table> </td> <else /> <td width="25%" class="alt1"></td> </if> <if condition="$count == $pertr"> </tr> </if> </if> |
#5
|
||||
|
||||
This is so cool, i think this is more or less working, will test it further.
I love you Velo ! Oh, I have another question though, In the query I make with the left join, The situation is this, in my vbgarage_images table, there can be a few images tied to a particular car ( cid ). But I only wanted to select ONE image for a particular car, how do I go about this ? Is there a way to insert a DINSTINCT in the sql statement ? |
#6
|
||||
|
||||
Ok i placed a GROUP BY u.cid in the sql statement and this proceeds to show just ONE thumbnail per car.
However, the page navi is now not accurate. How can i rectify this ? Pretty confused here. |
#7
|
||||
|
||||
Ok i got it working
i think haha Thanks again Velo !! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|