Support

Account

Forum Replies Created

  • Hi John,

    I’ve debugged my code. I really need to brush up on my php syntax. I have one more and hopefully final question about your solution.

    My link to what would be the single product page looks like this

    <a href="<?php echo $_SERVER['REQUEST_URI']; ?>?product ['$url_safe_product_name']">View Product</a>

    The REQUEST_URI gets the current post page but I can’t work out how find the url for ?product={‘$url_safe_product_name‘}

    Cheers

    Ger

  • Hi John,

    Thanks for getting back to me.

    I haven’t had any luck with the using the function to test the parameter. I get a white screen when I incorporate it in my code.

    I’ve streamlined my original down for testing:

    <div class="container">
        <?php if( have_rows('product') ): $i = 0; ?>
        <?php while( have_rows('product') ): the_row(); $i++; ?>
        <h1>Repeater - <?php echo $i; ?></h1>
        <?php endwhile; ?>
        <?php endif; ?>
    </div> 

    I’ve tried a number of combinations for using $_GET with my code but haven’t gotten anywhere. Below is my most recent attempt.

    <div>
         <?php 
            if (!isset($_GET['product'])) { 
            // show just one product
                if( have_rows('product') ): $i = 0; {
                    while( have_rows('product') ): the_row(); $i++;
                echo '<h1>Repeater - ' . $i'</h1>' ;
                    endwhile;
                    }
                endif;
    
    } else {
        
        echo '<a href="${current_page_url}?product={$url_safe_product_name}">View Product</a>';
    }
    
        endif; 
        
        ?>
    </div>    
    

    Thanks again for taking the time to help with this it’s much appreciated.

    Ger

Viewing 2 posts - 1 through 2 (of 2 total)