除非我在页面顶部回显一个字符串,否则页面将不会加载

时间:2014-12-11 10:02:01

标签: php

我有一个product.php页面,用于加载母版页和带有其他内容的productFocus.php页面。但是,如果我不回显productFocus.php页面顶部的字符串,则不会加载该页面。主页总是按原样加载。

仅使用<?php ?>开始页面无效。

如何在productFocus.php中加载master.php的{​​{1}}内容,而不需要在product.php页面顶部回显字符串?

我使用JetBeans PhpStorm,但XAMPP给出了相同的结果......

product.php

productFocus.php

productFocus.php

    <?php
        include_once "db/db.php";
        if (isset($_GET["id"])) {
            $id = $_GET["id"];
            $product = get_product_by_id($id);
            $page_content = 'productFocus.php';
            include('master.php');
        } else {
            header("Location: http://localhost/site/index.php");
            exit();
        }

master.php

<?php echo "." ?> <<<<<<<<<<<<<<<<<<<<<<<< If this is removed the page won't load in the product.php page

<style type="text/css">
    ...
</style>

<div class="product-focus">
    <h3><?php echo $product->name ?></h3>
    <img src="images/products/<?php echo $product->image ?>">
    <div id="description">
        <h4>Productinformatie</h4>
        <p><?php echo $product->description ?></p>
        <h4>Partners</h4>
        <table>
            <?php
                foreach($product->partners_obj as $partner) {
            ?>
            <tr>
                <td>
                    <a href=<?php echo $partner->product_url ?> target="_blank">
                        <img id="partner" src="images/partners/<?php echo $partner->image ?>">
                    </a>
                </td>
                <td>
                    <a href=<?php echo $partner->product_url ?> target="_blank">€ <?php echo $partner->product_price ?> </a>
                </td>
            </tr>
            <?php
                }
            ?>
        </table>
    </div>
</div>

0 个答案:

没有答案