问题描述
我正在创建类似程序的购物车,因此在我请求或发送预订请求后,数据将被放置在第二个选项卡上。我已经完成了,但是问题是我需要删除第一个选项卡上的所选数据。这是供视觉参考的图像:
然后选择我的第二个标签
我已经尝试过使用新的Array和Array push,并在Array中使用它,但是仍然出现第一个选项卡数据仍显示的问题,如何隐藏或删除从第一个选项卡中选择的数据?这是我的代码
查看
<?PHP $newArray = array(); ?>
<?PHP foreach($dorms as $dorm): ?>
<?PHP
$res = $dorm['code'];
array_push($newArray,$res);
?>
<a class="text-decoration-none" href="<?PHP echo base_url() ?>pages/view/<?PHP echo $dorm['id']; ?>">
<div class="col-md-6 mt-4" style="margin-left: 6rem;padding-bottom: 1rem;">
<div class="card top-shadow" style="width: 12rem; text-align:center;display:inline-block;">
<div class="card-body">
<img src="<?PHP echo base_url(); ?>assets/images/dorms/<?PHP echo $dorm['image'] ?>" style="border-radius: 15%;width:100px;height:100px;">
<hr class="border-black">
<h5 class="card-title color-black">Room Type: <b><?PHP echo $dorm['type']; ?></b></h5>
<h5 class="card-title color-black">Room Cost: <br><b> P <?PHP echo $dorm['price']; ?>.00</b></h5>
<?PHP if ($dorm['status'] == 0): ?>
<h5 class="card-title color-black"> <b> <span class="badge badge-success">Reserve Now</span> </b></h5>
<?PHP elseif ($dorm['status'] == 1): ?>
<h5 class="card-title color-black"> <b> <span class="badge badge-info">Pending Reservation</span> </b></h5>
<?PHP endif; ?>
</div>
</div>
</div>
</a>
<?PHP endforeach; ?>
第二个标签
<?PHP foreach($dormreserved as $dormres): ?>
<?PHP
$pos = $dormres['code'];
?>
<?PHP if(in_array($pos,$newArray)): ?>
<a class="text-decoration-none" href="<?PHP echo base_url() ?>pages/view/<?PHP echo $dormres['id']; ?>">
<div class="col-md-6 mt-4" style="margin-left: 6rem;padding-bottom: 1rem;">
<div class="card top-shadow" style="width: 12rem; text-align:center;display:inline-block;">
<div class="card-body">
<img src="<?PHP echo base_url(); ?>assets/images/dorms/<?PHP echo $dormres['image'] ?>" style="border-radius: 15%;width:100px;height:100px;">
<hr class="border-black">
<h5 class="card-title color-black">Room Type: <b><?PHP echo $dormres['code']; ?></b></h5>
<h5 class="card-title color-black">Room Type: <b><?PHP echo $dormres['type']; ?></b></h5>
<h5 class="card-title color-black">Room Cost: <br><b> P <?PHP echo $dormres['price']; ?>.00</b></h5>
<h5 class="card-title color-black"> <b> <span class="badge badge-info">Pending Reservation</span> </b></h5>
</div>
</div>
</div>
</a>
<?PHP endif; ?>
<?PHP endforeach; ?>
控制器
public function home()
{
// Check login
if(!$this->session->userdata('student_logged_in')){
redirect('students/login');
}
$data['title'] = 'Home';
$data['dorms'] = $this->dorm_model->get_dorms();
$data['dormreserved'] = $this->dorm_model->get_reserves();
$this->load->view('templates/header',$data);
$this->load->view('students/pages/home',$data);
$this->load->view('templates/footer');
}
型号
public function get_dorms(){
$this->db->order_by('id','DESC');
$query = $this->db->get('dorms');
return $query->result_array();
}
public function get_reserves(){
$this->db->join('reserves','reserves.dorm_id = dorms.id');
$this->db->where('reserves.tenant_id',$this->session->userdata('student_user_id'));
$query = $this->db->get('dorms');
return $query->result_array();
}
解决方法
请更新\documentclass{beamer}
\usetheme{Madrid}
\makeatletter
\setbeamertemplate{headline}{}
\setbeamertemplate{frametitle}{%
\nointerlineskip%
\vskip-2pt%
\hbox{\leavevmode
\advance\beamer@leftmargin by -12bp%
\advance\beamer@rightmargin by -12bp%
\beamer@tempdim=\textwidth%
\advance\beamer@tempdim by \beamer@leftmargin%
\advance\beamer@tempdim by \beamer@rightmargin%
\hskip-\Gm@lmargin\hbox{%
\setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
\vbox{}\vskip-.75ex%
\vspace{1cm}% <- change here to whatever you want
\leftskip0.3cm%
\rightskip0.3cm plus1fil\leavevmode
\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\strut\insertframetitle\strut\par%
\ifx\insertframesubtitle\@empty\else%
{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
\fi%
\nointerlineskip
\vbox{}%
\end{minipage}}%
\beamer@tempdim=\ht\beamer@tempbox%
\advance\beamer@tempdim by 2pt%
\begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
\usebeamercolor{frametitle right}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
\pgfusepath{clip}
\pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
\end{pgfpicture}
\hskip-\paperwidth%
\box\beamer@tempbox%
}%
\hskip-\Gm@rmargin%
}%
\nointerlineskip
\vskip-0.2pt
\hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
\vskip-2pt
}
\setbeamertemplate{page number in head/foot}[totalframenumber]
\makeatother
\title[Word I choose]{text}
\author[\today]{names}
\date[]{\today}
\begin{document}
\begin{frame}
abc
\end{frame}
\end{document}
功能
\documentclass{beamer}
\usetheme{Warsaw}
\usepackage[threecols]{hackthefootline}
\title[word I choose]{text}
\author[\today]{names}
\date[]{\today}
\begin{document}
\begin{frame}
abc
\end{frame}
\end{document}