Jump to content

Recommended Posts

I have only used php includes to prevent the duplication of headers, nav, etc on a page in the past.

 

I have a BS in Computer Science so I am familiar with programming, but.....

 

I am trying to create a html / css photo portfolio website.

 

I want the portfolio page to have genre links (families, nature, weddings, etc) and hopfully with your help clicking those links would pull up that specified group of thumbs and drop them into the designated body area.  The page would include thumbs with a lightbox plugin.  I am not sure if the thumbs would have to be in an html file, or if this is a programming thing.

I am sure there are probably plugins to do this, I would rather code if it isn't TOO involved.  If someone knows of a good free plugin, that would be great too.

 

Any help would be greatly appreciated.

 

Steve

 

 

Link to comment
https://forums.phpfreaks.com/topic/165181-newbie-photo-genre-link/
Share on other sites

use $_GET, for example:

 

set your hyperlinks like so

 

<a href="www.mywebpage.com/gallery?=wedding>

 

then on the gallery page make code like so:

 

<?php
$page = $_GET['page'];

if ($page == 'wedding')
include ('wedding.php')
elseif ($page == 'family')
include ('family.php')
else
include ('gallery.php')
?>

 

i hope that helps,

shergold.

I am having some problems with this.  When I click on the link for the genre it isn't including the genre page.  If I go to view the source, it isn't listed their either.  What am I missing?!  I don't know if I need all the brackets in the php, I was getting "Unexpected elseif" without them.  Also, in the HTML files I am including, I don't have the body or html, tags, I hope that is right.

 

 

Let me post my code.

 

Here is the code for the links....

 

<ul id="genres">

<div id="genreswrap">               

<li><a href="?page=families"><img src="images/genre_families.png" /></a></li>

<li><a href="?page=nature"><img src="images/genre_nature.png" /></a></li>

<li><a href="?page=seniors"><img src="images/genre_seniors.png" /></a></li>

<li><a href="?page=engagements"><img src="images/genre_engagements.png" /></a></li>

<li><a href="?page=weddings"><img src="images/genre_weddings.png" /></a></li>

</div> <!-- genreswrap" -->

</ul> <!-- genres -->

 

 

Here is the content of one of the genre HTML files just as a test....

No HTML tag, or body, etc.....

 

<img src="images/nature/Nature-1.jpg" />

 

And lastly, here is the PHP code:

 

<?php

$page = $GET['page'];

if($page == "families") {

include ("families.html");}

elseif($page == "nature"){

include ("nature.html");}

elseif($page == "seniors"){

include ("seniors.html");}

elseif($page == "engagements"){

include ("engagements.html");}

elseif($page == "weddings"){

include ("weddings.html");}

?>

   

 

Again, I appreciate your help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.