On one perl page that prints out links to itself with ?variable=value on them so it prints out new info.
This value is a directory name. The info is the contents of the directory.
So I can go to this file and click links to view the contents of other directories.
At the top of this multi-tasking perl page is a printed out line of what directory on the server I am viewing, this is printed out from a hard set variable and the sent value.
I want to be able to use this printed out line to have each directory name turned into a link that links again to this same file but with the new value.
its a bit like this:
#!/usr/bin/perl
use CGI;
$query = new CGI;
$dire = $query->param("dire");
print $query->header ( );
$live = "/home/client/www/site";
print "$live<a href=\"./index.cgi?dire=$dire\">$dire</a>";
print "<br><br>"
#then my readdir which reads $live$dire and prints out the contents
So when I click on the linked part it takes me to view the contents of that directory. Simple.
This works fine when I am in "/html" and $dire is "/html" But not when I am in "/html/code" and $dire is "/html/code".
When it is this case and it prints out
home/client/www/site/html/code
I want to be able to click on the "html" part of that line and have it take me to "./index.cgi?dire=/html"
or to click the "code" part of that line and have it take me to "./index.cgi?dire=/html/code"
You get the idea, i want to be able to move back directories. How can I split up $dire and print it out as separate links?
Thank you for any help or pointers. I tried my best to describe the problem but if it's not clear let me know!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.