点击VIEW按钮后没有发生任何事情,我开始想知道出了什么问题?
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>
答案 0 :(得分:0)
我认为你应该使用链接并将它们描述为按钮(角色,类型,无论如何)并使用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>
通过搜索更好的解决方案,我发现answer from BalusC我认为应该解决您的问题并帮助您了解关于按钮,链接等问题的方式/内容/时间。