我有一个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>