簡體   English   中英

單擊查看按鈕,沒有任何反應

[英]Clicking view button and nothing happens

單擊“查看”按鈕后,什么都沒有發生,我開始懷疑這是怎么回事?

GALLERIES NAME  POST    EDIT    DELETE  
Slideshow               VIEW     
SERVICES        POST    VIEW     

碼:

<?php foreach ($gallery as $gallery_item): ?>
    <tr>
        <td><?php echo $gallery_item['galleries_name']; ?></td>
        <td>
            <?php if( $gallery_item['galleries_post_type'] == 'post') { echo "#"; }?>   
        </td>
        <td>
            <button type="button" class="edit" onclick="location.href = '
                <?php 
                if( $gallery_item['galleries_post_type'] == 'post') {
                    echo site_url('cpages/galleries/'.$gallery_item['galleries_id']); 
                } else {                                
                    echo site_url('cpages/viewpictures/'.$gallery_item['galleries_id']); 
                }
                ?>
            ';">VIEW</button>
        </td>

我認為您應該使用鏈接並將其描述為按鈕(角色,類型等),並使用CSS裝飾它們。 那是:

<?php

$id = $gallery_item['galleries_id']);

?>

<td>
    <?php if ($gallery_item['galleries_post_type'] === 'post'): ?>
        <a href="<?= site_url('cpages/galleries/'.$id); ?>" class="edit">
    <?php elseif (): ?>
        <a href="<?= site_url('cpages/viewpictures/'.$id); ?>" class="edit">
    <?php endif; ?>
</td>

通過尋找更好的解決方案,我從BalusC中找到了一個答案 ,我認為該答案應該可以解決您的問題並幫助您了解有關按鈕,鏈接等的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM