Codeigniter get_where类别id =论坛ID

问题描述 投票:-1回答:2

如何在codeigniter中创建类别和论坛之间的关系?首先我获取所有类别,将它们放在一个数组中,然后在我的论坛上显示它们,如下所示:

        // $this->db->order_by('category_position', 'asc');
        // $q = $this->db->get('categories');
        // return $q->result_array();

这非常有效。接下来我应该怎么去获得与类别相关的所有论坛?我应该如何使用codeigniter的get_where - 然后从另一个方法说明forum id = category id?

我的数据库很简单,包含以下内容:

        // For categories: category_id, category_position, category_title
        // For forums: forum_id, forum_position, forum_title
php codeigniter
2个回答
1
投票

你提到没有CSS Grid或bootstrap,你能使用flex吗?如果是这样,你可以做到:

.fluid-parent {
  display: flex;
  height: 100px;
}

.fixed-child {
  width: 100px;
  background: red;
}

.fluid-child {
  flex: 1;
  background: blue;
}
<div class="fluid-parent">
  <div class="fixed-child"></div>
  <div class="fluid-child"></div>
</div>

0
投票

一种解决方案是将div与设定宽度绝对定位。并为容器的填充添加相同的大小以相应地抵消第二个div。

.container {
  background-color: red;
  width: 300px;
  padding-left: 100px;
  /*Width of the left div*/
  position: relative;
}

.left {
  width: 100px;
  background-color: green;
  position: absolute;
  left: 0;
}

.right {
  background-color: blue;
}

div {
  height: 200px;
}
<div class="container">
  <div class="left"></div>
  <div class="right"></div>
</div>
© www.soinside.com 2019 - 2024. All rights reserved.