douou8954 2015-09-25 18:34
浏览 41

基于导航选择加载php元素

I want it so that when the user clicks on a link that takes it to the birthday section of a site it only loads images from the birthday folder. I have the categories defined but can't seem to get it to work right. it should be img/catagory/filename.

<body>
<main>

<?php
//bring in external files
include_once('config/spc_database.php');
include_once('object/cake.php');

//make a db object:
$database = new Database();

//make it connect:
$conn=$database->getConnection();
//instantiate a new movie object
$cake =  new Cake($conn);
//get the id being passed in the URL query string($_GET array)
//and store it in the id property for the Cake object
$cake->id = $_GET['detailsid'];

//run a SELECT * query with WHERE so it gets one row
$stmt = $cake->readDetails();
//loop through that variable, repeating a procedure once per row            
?>

<div id="container" class="group">
    <div class="left-content">
    <?php
    while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    ?>
        <div class="main-description-image">
            <img src="img/all_cakes/<?php echo $row['large']; ?>" alt="placeholder" class="large-img"/>
        </div>
        <div class="cake-descript-info">
            <h2 class="header-title"><?php echo $row['name']; ?></h2>
            <p class="body-text-descript"><?php echo $row['description']; ?></p>
            <span class="prices">Cost: $<?php echo $row['price']; ?></span>
        </div>
    </div>
</div>
<div class="container-img">
    <div class="dropdown-description styled-select">
        <select id="Category">
            <option value="hide">-- Pick a category --</option>
            <option value="Wedding cakes">Wedding cakes</option>
            <option value="Birthday cakes">Birthday cakes</option>
            <option value="Cupcakes">Cupcakes</option>
            <option value="Specialty sweets">Specialty sweets</option>
            <option value="Traditional">Traditional</option>
            <option value="Modern">Modern</option>
            <option value="Themed">Themed</option>
            <option value="Festive">Festive</option>
        </select> 
    </div>
    <div class="top-left-box-description hvr-grow">     
        <a href="description.php?detailsid=<?php echo $row['id'];?>"> <img src="img/<?php echo $row['category']; ?>/<?php echo $row['thumb']; ?>" </a>
    </div>
    <div class="top-right-box-description hvr-grow">
        <a href="description.php?detailsid=<?php echo $row['id'];?>"> <img src="img/all_cakes/<?php echo $row['thumb']; ?> " class="tmbnails"</a>
    </div>
    <div class="bottom-left-box-description hvr-grow">
        <img src="img/small-thumbnail-placeholder3.jpg" class="tmbnails" alt=""/>
    </div>
    <div class="bottom-right-box-description hvr-grow">
        <img src="img/small-thumbnail-placeholder4.jpg" class="tmbnails" alt=""/>
    </div>
    <div class="bottom-order-description">  
        <section class="buttons">
            <div class="container-btn"> 
                <a href="#" class="btn btn-3">Order</a> 
            </div>
        </section>
    </div>
</div>         
<?php 
}
?>  
  • 写回答

1条回答 默认 最新

  • doutao6380 2015-09-25 21:59
    关注

    the page is a read details, read all had the categories but read details did not $stmt = $this->conn->prepare('SELECT id, name, category, description, price, thumb, large FROM '.$this->table_name.' WHERE id='.$this->id);

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)