Jump to content

href calling php function w/ parameters


dogger

Recommended Posts

OK, in my html file, I have "${uri}" which is a directory/filename.  A link (href) is created directly from "${uri}" that opens the file when clicked.  This works great.

 

<dd><a href="${uri}">${uri}</a> (${size} bytes)<br><br></dd>

 

Now, I want to also add the ability to explor the directoy.  So I want to add another link (href) with the directory only include in "${uri}".  For example, if "${uri}" = '/this/is/the/directory/and/thefile.txt', I want an href w/ '/this/is/the/directory/and'

 

I created the file dir.php w/ the following

 

<?php

function giveme_dir_only( $a )

{

    $mydir = dirname($a );

    return $mydir;

}

?>

 

Now, how do I add this to my html/href command.  There is no reason to run the dir.php until the user actually clicks on the link, eh? 

 

<dd><a href="xxxx">"xxxx"</a> <br><br></dd>

 

Thanks in advance for the help!

Link to comment
Share on other sites

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.