The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Creating a line break after x images
Hey all,
I'm not too clued up on whiles -- had a look but it messed up pretty early on. Basically what I need to do is put this code : PHP Code:
There are two variables set here, one is the total number of images to be used ($number_of_images_to_show) and then how many across it should go ($numx). Hope someone can explain this one for me! TIA Jason |
#2
|
|||
|
|||
Are you going to be fetching the images (or image data) from a database? If so you just use it as a standard while() loop. Like this:
PHP Code:
|
#3
|
||||
|
||||
Pre-incrementing is faster than post-incrementing - so pre-increment.
PHP Code:
|
#4
|
||||
|
||||
Quote:
--------------- Added [DATE]1212946799[/DATE] at [TIME]1212946799[/TIME] --------------- Basically put this is what I'm aiming for it to do .. trust me, this is in basic terms! If there are 10 images to be displayed and every 5 images, it needs to insert a line break. So it counts out 5 images, then inserts a line break, to display the final 5 images. Both the amount of images and the number per line are defined in the admincp. |
#5
|
|||
|
|||
What are you "cycling" through then? Are you going through and array or what? (where are the 10 images - or their associated data - coming from basically)
|
#6
|
||||
|
||||
Here is the entire code, it's outputting an image to a template ($imagebits), but I've discovered an issue with one particular browser, usually it wraps the images around when hits the edge, but this one won't, so I need to add a system where the number of images on a line can be chosen.
PHP Code:
Cheers Jason --------------- Added [DATE]1212948569[/DATE] at [TIME]1212948569[/TIME] --------------- I should have said that there is an outside script - show.php which creates the images, but it's all called back into this plugin - and is finally output in the $eic_imagebits template |
#7
|
|||
|
|||
Try avoid using the shortcut if syntax:
PHP Code:
Anyway, after your template eval() you could add something like: PHP Code:
|
#8
|
||||
|
||||
I found out that it wouldn't work correctly with certain curly brackets it ... so they were removed, hence why they're not there.
I've tried the code you suggested after the eval() and it doesn't work, the plugin fails to load and executes the script after it. The original code you posted : PHP Code:
PHP Code:
Hopefully you can follow my thinking! I thought this would be fairly straightfoward but as with everything I do, proving a headache!! Cheers, Jason |
#9
|
|||
|
|||
Curly braces won't affect the code execution unless you have not matched them up correctly. They are there to make code more readable.
Why did you insert the code I gave in my first post? (I suggested different code in my second post...) Try this: PHP Code:
|
#10
|
||||
|
||||
Believe it or not, but using that code, it doesn't work. When I paste in my original code - it works fine!
I will admit my brother in law did code most of this, he's a LOT more clued up with php than I am .... but he explained about the curly braces and why they weren't there, I understand with them there they make the code easier to understand but on this lot, they need to be missing for the code to execute. Forgot to mention, that code I tried was with the extra part still commented out. Thanks for your help on this, I am extremely grateful. Jason |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|