Jump to content

I Really Need This Code


Guest dude

Recommended Posts

Guest dude

i am working on gallery project. I need your help friends. My project is saved on http://localhost/gallery. Now here i can see two category animals and birds. When i click on animals it show a gallery of animals animals.php. If i on lion it show lion gallery with 5 or six pics lion.php. When i click on any one on this, pics one in new window image.php.So what i want,Http://localhost/gallery does not show any link on top.Http://localhost/gallery/animals show "gallery > animals".Http://localhost/gallery/animals/lion show "gallery > animals > lion"where gallery should link with Http://localhost/gallery.phpanimals shold link with Http://localhost/gallery/animals.phpand lion should link with Http://localhost/gallery/animals/lion.php Sorry for my poor english. I need help. Please help me. I need a code that can be post on each page.Thanks.

Link to comment
Share on other sites

If the folder names match what you want the links to show, then the easiest way would be to get the path to the current script and print each folder name as a link. You need to have a variable defined that holds the base directory of the gallery, so the base would be c:\inetpub\wwwroot, for example, or whatever your base path is. You can get the directory name of the current script with dirname(__FILE__). You can use substr_replace to remove the base path from the full path, and you'll be left with a list of folders that you would show for links. Inside Http://localhost/gallery/animals/lion/index.php, dirname(__FILE__) might return "c:\inetpub\wwwroot\gallery\animals\lion", and when you use substr_replace to remove the base path, you would be left with "\gallery\animals\lion", which is what you want for the links. You can use explode on that to split up each folder name, and loop through them to write the links out.http://www.php.net/manual/en/function.dirname.phphttp://www.php.net/manual/en/function.substr-replace.phphttp://www.php.net/manual/en/function.explode.php

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...