Advanced Search

Results 1 to 3 of 3

Thread: Only display link if PDF file exists

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Only display link if PDF file exists

    I have created a results page on my golf club’s website www.forestofgaltres.co.uk/fixtures.htm

    At the beginning of each month I create links on the results page for that month and upload blank PDF documents in date format (20070430.pdf) to the corresponding links.

    After each competition someone at the club uploads the results overwriting my blank templates.

    This works, but I was wondering if there is a way of having a link on my results page which is only active or displayed etc if the relative PDF file has been uploaded.

    If this is not possible, maybe a pop up message box if the PDF file didn't exsist?

    This would save me uploading blank PDF files and look a lot more tidy!

    Thank you
    John

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    261
    Thanked 690 Times in 678 Posts

    Default

    PHP Code:
    <?php
    if (file_exists('some.pdf')) {
    echo 
    '<a href="some.pdf">some.pdf</a>';
    }
    else {
    echo 
    'no pdf available';
    }
    ?>
    Something like that should work, with a bit more customization.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply - Could you give me a few more tips on this, I've had a search on php but I'm a novice on stuff like this.

    Thankyou

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •