FORUMS: list search recent posts

Repeat Regions

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Richard WilliamsRepeat Regions
by on Jan 26, 2011 at 7:56:30 pm

Hi All,

OK im fairly certain i know what the reply is going to be here... but im going to ask anyway just in case there is a simpler solution.

Here... http://www.ease.uk.net/products1.php i have a products list. Clicking on one of the product ranges submits an id to the next page, and that page is set up repeating recordset1, recordset2 all the way to recordset 8, with repeat regions and show if regions.
So if a product has sub categories 1 2 3 4 5 6 7 and 8 then it displays all eight recordsets, if it only has 1 2 3 it only shows recordsets 1 2 and 3 etc...

Ok.. all good.

Problem.
If you click on consumables... there is only one sub category there but quite alot of products. The client has asked that when this is the case, can i break the boxes up and display say 10items, then start a new box showing another 10 items etc...
Ive said flat out NO.. since it is dynamic content this just is not possible... Everyone agree???


Return to posts index

Curtis ThompsonRe: Repeat Regions
by on Jan 26, 2011 at 8:22:17 pm

hello...

[Richard Williams] "Ive said flat out NO.. since it is dynamic content this just is not possible... Everyone agree???"

unfortunately, nope - can't agree... :-)

not sure if you mean another page after 10 items, or literally just another box - so like:

-----
|p1 |
|p2 |
|...|
|p10|
-----

-----
|p11|
|p12|
|...|
|p20|
-----

but either one is possible. if you mean the example above, then you'd do this:

i assume that you have your products showing in a loop. if so, then it's probably like:

// echo box code opener

foreach ($prod as $p) {
// echo product $p to screen
}

// echo box code closer

you can alter that to restart a box in the loop at any given point - so like:

$break_at = 10; // show this many products per box
$bt = 1; // our tally tracker

// echo box code opener

foreach ($prod as $p) {
// echo product $p to screen
$bt++;
if ($bt == $break_at) {
// echo box code closer
// echo box code opener
$bt = 1; // start the tally over
}
}

// echo box code closer

rough example, but that's how you'd do it...make sense? or is that not what you mean?

sitruc


Return to posts index

Richard WilliamsRe: Repeat Regions
by on Jan 26, 2011 at 9:01:43 pm

sitruC :o)
this is probably one of those times that a print screen migh help...



You see what i am doing is bringing in the product ID and recordsets are then filtered by product id that comes in to page...

as in you select polythene/timber, that sends a product id of 5

so the recoredset 1 is 5.1 recordset2 5.2 etc... There can be only 8 sub categories the way ive set up page (rushed)

So where there is only 1 sub category, like in consumables, the list is one long list, so they wanted me to break that list up on the page. The problem with this is that obviously they might well increase products over time, and then one of the products with 8 sub cats could end up needing to be broken up and suddenly i got 9 boxes then they wont like that, theyll want me to sort that out... they are very clean on what they want visually but somethings i think are just not possible to keep other things the way they want it...

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index


Curtis ThompsonRe: Repeat Regions
by on Jan 26, 2011 at 9:03:55 pm

ooh - sorry. with the screenshot and additional info, it got more confusing as to what you want to achieve... :-/


Return to posts index

Richard WilliamsRe: Repeat Regions
by on Jan 26, 2011 at 9:21:09 pm

lol.. oh sorry... i got a habbit of that.

OK
I have 8 boxes on the screen. Is it possible to ADD a rule limiting how many items appear in one box, then start a new box next to it with the remaining info from a recordset before it gets to recordet 2box.

So.. lets say i have 10records in recordset 1 and 12 in recordset two, i get two boxes show... box 1 and 2

Now lets say i have 30 records in recordset 1 and 12 in recordset two

Can i have a box with 15 from recordet 1, another box with 15 remaining recordset 1's, then a box with recorset 2

so box 1, box 1b and box 2... make sense?

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Curtis ThompsonRe: Repeat Regions
by on Jan 26, 2011 at 9:31:35 pm

hello...

well - w/o knowing exactly what you mean by "recordset" (and i mean in terms of what that represents in your code - an item in an array, i assume?) it's tough to say...but...

the same advice i had before would still apply - so i guess that a recordset means something else in your code. but the same logic applies. if you are looping through your records and drawing them in a box, you can just set up a variable to say "after X items, stop this box, draw a new box and then continue rendering in that new box"...

does that seem to apply to your setup at all?

sitruc


Return to posts index


Richard WilliamsRe: Repeat Regions
by on Jan 26, 2011 at 9:46:18 pm

sorry... im using Dreamweaver to build my php code im not coding it myself...

<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
<div class="productsmain">
<div align="center"><strong><?php echo $row_Recordset1['sub_category']; ?></strong><br />
</div>
<br />
<img src="images/subcat_images/<?php echo $row_Recordset1['id']; ?>1.jpg" width="210" height="70" /><br />
<br />
<?php do { ?>
<h6><span class="h5"><a href="quotation.php#<?php echo $row_Recordset1['sub_category']; ?>"><?php echo $row_Recordset1['code']; ?></a></span><a href="quotation.php#<?php echo $row_Recordset1['sub_category']; ?>">&nbsp;&nbsp;<?php echo $row_Recordset1['description']; ?>&nbsp;<?php echo $row_Recordset1['size']; ?>&nbsp;<?php echo $row_Recordset1['price']; ?></a><br />
</h6>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</div>
<?php } // Show if recordset not empty ?>


Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Richard WilliamsRe: Repeat Regions
by on Jan 26, 2011 at 9:54:27 pm

i guess really the answer i was looking for is yes it is possible... Which kind of sucks a bit from my end. lol.. cant you just reply again and say i agree Richard, its impossible? lol

Do you know how i might search for how to do this? Whats my search criteria becasue its not really looping or repeat regions... how would you word it Curtis?

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Curtis ThompsonRe: Repeat Regions
by on Jan 26, 2011 at 9:55:03 pm

hello...

well - yup. you would add the code that i posted in the first response in your do -> while loop and just start a new box after the counter reached your threshold.

but alas, i don't use dreamweaver, so i can't tell you how you would use their interface to do that...but this is the rough model for it:

<?php
$break_at = 10; // show this many products per box
$bt = 1; // our tally tracker
?>

<?php do { ?>
... existing html code
<?php
$bt++;
if ($bt == $break_at) {
?>
... box code closer
.... box code opener
<?php
$bt = 1; // start the tally over
?>
<?php
}
?>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>


sorry i can't be of more help in dreamweaver itself... :-/

sitruc


Return to posts index


Richard WilliamsRe: Repeat Regions
by on Jan 26, 2011 at 10:10:08 pm

ill see if i can work it into my code... Thanks alot you have been more than helpful.

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]