开发者

Grid/List view with image size

开发者 https://www.devze.com 2023-04-01 03:02 出处:网络
I have problem with change images size in posts (after click on the buttons grid/list). these are the buttons that should (after click) change $value to true or false (that scale images):

I have problem with change images size in posts (after click on the buttons grid/list).

these are the buttons that should (after click) change $value to true or false (that scale images):

<div class="products_look">
        <input type="button" class="view_list" onclick="" value="List" />
        <input type="button" class="view_grid" onclick="" value="Grid" />
</div>

and this is the php functions that generated grid or list view in the posts:

<?php
    if($value == true) {
      echo image_products_grid();
    }
    else {
      echo image_products_list();
开发者_运维技巧    }
?>

What I need to insert in onClick tags that after clicking on the button returned php $value (true or false)?


Why not use a parameter in the URL? Something like this:

<div class="products_look">
    <input type="button" class="view_list" onclick="window.location = 'display.php?type=LIST'" value="List" />
    <input type="button" class="view_grid" onclick="window.location = 'display.php?type=GRID'" value="Grid" />
</div>

And then on your PHP page:

<?php
    if($_GET["type"] == "GRID") {
      echo image_products_grid();
    }
    else {
      echo image_products_list();
    }
?>

Is this the type of solution that you are looking for? It's not terribly elegant, but your question is a little unclear so I hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号