Jump to content

Calling a new Include from a href link


GreenMarch

Recommended Posts

Hi there.

 

I would appreciate some help with a small problem I have.

 

Is it possible to swop an include file on a page being displayed by clicking a link?

 

On one of my sites I call a set of images into a gallery with an include file.  What I would like to do is call a different set of images in another include file by clicking a link.  The site is a databaseless site and uses php to display common content via includes instead of a template.

 

The gallery is a pure CSS gallery and so I limit image numbers for loading time purposes.  The gallery has four sets of images (and growing) and at the moment I am linking to an identical page calling a new set of images with an include which seems a bit cumbersome.

 

Any help gratefully received.

Link to comment
https://forums.phpfreaks.com/topic/111800-calling-a-new-include-from-a-href-link/
Share on other sites

<a href="www.yoursite.com/gallery/index.php?include=gallery1"></a>

 

<?php

if(isset($_GET['include'])) { include($_GET['include']); }

 

I'm not entirely sure what you mean, but you could probably do something along those lines.

 

Regards ACE

Hi Ace - thanks for taking the trouble to respond.

 

I'll try and explain better.... I have a page that calls a set of images into a css gallery.  The set is an include file.

 

I want to change the set of images on the page (and therefore change the include file) when a visitor clicks a "more images" link and a "previous images" link.

 

I suppose this will involve putting all the image include files into an array with a function that calls first include file when page is opened, the next include file when "more" is clicked and previous include file when "previous" is clicked.

 

Is this do-able with GET or REQUEST?

 

I am a php novice - so really don't know where to start.

 

 

Archived

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

×
×
  • 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.