Jump to content

Page content via PHP


Sirax

Recommended Posts

Hey all,I'm building a website that you can view HERE.Now as you can see, I'm using a PHP navigatie script to navigate through the menu at the top, so I don't have to copy whole the main information on many pages (like nav menu, header, latest news, footer,.. is all on one page, index.php) the content itself is on different pages.But now when you go to FOTO'S -> De Realisaties (third photo) : OR JUST CLICK HERE.You can see a list where you can click on all links, now when you click on "Zonnepanelen" OR CLICK HERE AGAIN, you can see that another page content opens with some pictures, but the list also appears again, but thats not good, only the pictures must be seen there.For those 2 pages (list page and pictures page) I've used 2 php pages (realisaties.php and realisaties_omschrijving.php), the first one is with the list on, the second one is with all the pictures in, now this is the code I've used so far:realisaties.php

<?php$fotos = isset($_GET['fotos']) ? $_GET['fotos'] : "leeg";?>			<!--  / left container \ -->			<div id="leftCntr">				<!--  / text box \ -->				<div class="textBoxFotos">					<h2>Foto Gallerij</h2>										<div id="SpecialisatieDakwerken">					<p><h3>De Realisaties</h3></p>					<p>• <a href="?p=realisaties&fotos=allerlei"><?=$fotos==="allerlei" ? "Allerlei" : "Allerlei"?></a></p>					<p>• <a href="?p=realisaties&fotos=dakramen"><?=$fotos==="dakramen" ? "Dakramen" : "Dakramen"?></a></p>					<p>• <a href="?p=realisaties&fotos=industrieledaken"><?=$fotos==="industrieledaken" ? "Industriële daken" : "Industriële daken"?></a></p>					<p>• <a href="?p=realisaties&fotos=leien"><?=$fotos==="leien" ? "Leien" : "Leien"?></a></p>					<p>• <a href="?p=realisaties&fotos=pannen"><?=$fotos==="pannen" ? "Pannen" : "Pannen"?></a></p>					<p>• <a href="?p=realisaties&fotos=schouw"><?=$fotos==="schouw" ? "Schouw" : "Schouw"?></a></p>					<p>• <a href="?p=realisaties&fotos=sidding"><?=$fotos==="sidding" ? "Sidding" : "Sidding"?></a></p>					<p>• <a href="?p=realisaties&fotos=zinkwerk"><?=$fotos==="zinkwerk" ? "Zinkwerk" : "Zinkwerk"?></a></p>					<p>• <a href="?p=realisaties&fotos=kasteel"><?=$fotos==="kasteel" ? "Kasteel van Sterrebeek" : "Kasteel van Sterrebeek"?></a></p>					<p>• <a href="?p=realisaties&fotos=zonnepanelen"><?=$fotos==="zonnepanelen" ? "Zonnepanelen" : "Zonnepanelen"?></a></p>					</div>					<div id="SpecialisatieMenda">					<p><h3>Menda Brussel</h3></p>					<p>• <a href="?p=realisaties&fotos=kemperol"><?=$fotos==="kemperol" ? "Kemperol" : "Kemperol"?></a></p>					</div>					<?phpif($fotos==="leeg"){?><?php }else{?><?php require_once"pages/realisaties_omschrijving.php";?><?php }?>				</div>				<!--  \ text box / -->			</div>			<!--  \ left container / -->

realisaties_omschrijving.php

<?php if($fotos == "leeg"){/* --------------*/?><?php } elseif($fotos == "zonnepanelen"){/* --------*/?>										<p>Zonnepanelen</p>					<div class="RealisatiesFotoBox">					<div class="foto"><a href="fotos/zonnepanelen/pic01.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic01.jpg" width="140" height="117" alt="" /></a>					</div>					<div class="foto"><a href="fotos/zonnepanelen/pic02.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic02.jpg" width="140" height="117" alt="" /></a>					</div>					<div class="foto"><a href="fotos/zonnepanelen/pic03.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic03.jpg" width="140" height="117" alt="" /></a>					</div>					<div class="foto"><a href="fotos/zonnepanelen/pic04.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic04.jpg" width="140" height="117" alt="" /></a>					</div>					<div class="foto"><a href="fotos/zonnepanelen/pic05.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic05.jpg" width="140" height="117" alt="" /></a>					</div>					<div class="foto"><a href="fotos/zonnepanelen/pic06.jpg" rel="lightbox[10]" title="Zonnepanelen"><img src="fotos/zonnepanelen/pic06.jpg" width="140" height="117" alt="" /></a>					</div>					</div>					<?php } ?>

So can anyone help me with this? Why on THIS PAGE the list is also visible?Thanks in advance,

Link to comment
Share on other sites

I think you need to include the content you are trying to show within the if/else statements. Otherwise, the browser will render all the HTML, regardless of the conditionals being set with PHP. In other words, all the content that you want to show with if or else, must all be contained within one <?php ?>. To print HTML straight to the page, just use echo.

Link to comment
Share on other sites

Ok thanks, I found the solution for this :)I had to place the php code like this:

				<h2>Foto Gallerij</h2>				<?php$fotos = isset($_GET['fotos']) ? $_GET['fotos'] : "leeg";if($fotos==="leeg"){?>										<div id="SpecialisatieDakwerken">

Thanks for the help m8.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...