简体   繁体   English

如何在Codeigniter中基于获取的ID启用链接

[英]How to enable the link based on the fetched id in codeigniter

I have two details page, each has a link "back to the listing page". 我有两个详细信息页面,每个都有一个“返回列表页面”链接。 There are two listing pages. 有两个列表页面。 Now I want when the user clicks on the link, it will take him out and will put him on previous page from where he came. 现在我想要当用户单击链接时,它将把他带出并将其放在他来自的上一页。 I've Interior page and Architect page, each of the page contains lots of profile and a link "view more" to end of each profile. 我有“内部”页面和“架构师”页面,每个页面包含大量个人资料,并在每个个人资料的末尾添加了“查看更多”链接。 Problem is when click on view more it redirecting to the ful details page but there is a link "back to the listing page" when click on that link i want to redirect the page to the previous page ( example: Came from interior page so click on back link option should take me to interior page ) 问题是,当单击“查看更多”时,它将重定向到ful详细信息页面,但是单击该链接时有一个链接“返回到列表页面”,我想将该页面重定向到上一页(例如:从内部页面来,因此请单击返回链接选项应将我带到内页)

I've done almost but need little help 我已经快做完了,但几乎不需要帮助

<p class="link_back">
    <!-- <small> <a href="<?php echo base_url(''); ?>">Back To List Page </a> </small> -->
      <?php
      $category = $article->category_id; // assuming this returns 1 or 0
       if($category == 1) {
         echo "(<small> <a href=' echo base_url('');'>Back To List Page </a> </small>)";
       } if($category == 3) {
       echo "(<small> <a href=' echo base_url('welcome/architect');'>Back To List Page </a> </small>)";
       } else {
       echo "(<small> <a href=' echo base_url('');'>Back To List Page </a> </small>)";
          }
           ?>
</p>

Window.history将是我选择的答案

<a href="#" onclick="window.history.back();">Go back</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM