Jump to content

Recommended Posts

What I am trying to do is dynamically create thumbnail hyperlinks on a gallery page based upon the names of Folders within a directory. Then, I want to be able to click each thumbnail generated and have each of them call a specific php file, but in addition, pass a variable, which is the name of the folder. Clicking the link, the php will generate a pop-up gallery template populated with images in a folder based upon the variable clicked.

 

This is a step in the process of creating a dynamic gallery page with custom pop-up galleries. I am wanting to do this, so I can upload images / files into a folder, and have the code know what to do with it so I don't have to update my website myself, because I just don't have the time.

 

I hope that got across what I am wanting / trying to do. The specific part I am hung up on is the generation / code of the dynamic hyperlinks, and with the example I have below, i was wondering if this is on the right track. Thank you for your help!!

 

1. Using php, grab all Names of Folders in a specific directory into an array. Array name = galleryArray

 

2. Create a For Loop that creates X number of hyperlinks to phpCode.php passing galleryArray.

 

Link Example:

<a href='phpCode.php?galleryArray"><img src="directory/galleryArray_tn.jpg" alt="galleryArray"/></a>

 

Any help would be great since I am very new to PHP.

Link to comment
https://forums.phpfreaks.com/topic/82841-dynamic-hyperlinks-and-passing-variables/
Share on other sites

Well, I did add galleryArray"["i"]"  (withought the quotes as I forgot about forum code).

 

So, would something along those lines work for distinguishing which gallery page that these thumbnails would be opening?  That was our major problem, having it all point to the same php file, but then know what content that the page needs to populate with.

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.