The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Break after X amount of images
I've got a page displaying the members' profile pictures. The problem is that all the pictures are being placed on one line, so I'm trying to figure out how to add a <tr> after 5 images have been displayed. I've seen a few gallery hacks do this, but I only partially understand the process. This is what I've got so far:
PHP Code:
HTML Code:
<if condition="$user_count > '5'"> </tr><tr> </if> |
#2
|
|||
|
|||
Consider setting a counter and then use something like follows:
Code:
if ($counter % 5 == 0) { // do </tr><tr> thing } |
#3
|
||||
|
||||
That's sort of what I was trying, only problem is, I'm not sure where to stick the if condition.
|
#4
|
||||
|
||||
After the final line, before the closing bracket I would guess.
You also need the $counter - setting it to 0 before the while, and adding 1 to it inside the loop. |
#5
|
||||
|
||||
$counter would be the same as my $user_count var, would it not?
|
#6
|
|||
|
|||
Nope, your $user_count is the amount of rows in the database. $counter will act as a counter, and increment every time the while loop is processed.
So in your while loop you need: PHP Code:
|
#7
|
||||
|
||||
Well it seems like I've done everything right, but I still can't get the pictures to break after the 5th. But thanks for all your collective attempts.
The code works fine, it must be something with my html, as far as I can tell. Would it be more than a </tr><tr>? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|