Forums

Display X number of page buttons in a row, then break, then display contents (3 posts)

  1. S3nd41
    Member
    Posted 6 months ago #

    Hi guys,

    I'm trying to create a page layout that displays a row of 6 pages in the form of buttons with images (these images are associated with each specific page with Magic Fields) and, when they're clicked, a row of contents is displayed below that row of 6 buttons (with a show/hide script). I can't display the contents in-line with the buttons because that way it will break my button row, therefore I have to use a scheme like this:

    Button 1 | Button 2 | Button 3 | Button 4 | Button 5 | Button 6
    Hidden Content 1 | Hidden Content 2 | Hidden Content 3 | Hidden Content 4 | Hidden Content 5 | Hidden Content 6
    
    Button 7 | Button 8 | Button 9 | Button 10 | Button 11 | Button 12
    Hidden Content 7 | Hidden Content 8 | Hidden Content 9 | Hidden Content 10 | Hidden Content 11 | Hidden Content 12

    Does anyone know how I can achive this tipe of page listing?

    Thanks!

  2. S3nd41
    Member
    Posted 6 months ago #

    I think this can be achieved by creating a loop within a loop. Something like this?

    <?php
    query_posts('');
    $ids = array();
    while (have_posts()) : the_post(); $c++;
    if( $c == 6) {
    	$c = 0;
    
    query_posts('');
    while (have_posts()) : the_post(); $d++;
    if( $d == 6) {
    	$d = 0;
    }
    else $style='';
    $ids[] = get_the_ID(); 
    
    endwhile;
    
    }
    else $style='';
    $ids[] = get_the_ID(); ?>
  3. S3nd41
    Member
    Posted 6 months ago #

    I followed a tutorial and ended up with this:

    http://pastebin.com/MQss2WXR

    But this way I have to define a new variable with gradually increasing offset and copy paste the 2 loops over and over. Is there some way to make him repeat the loops automatically?

Reply

You must log in to post.

About this Topic