Results 1 to 3 of 3

Thread: dhtmlwindow.open if else linking

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default dhtmlwindow.open if else linking

    i need help bad. It might be an easy fix but i cant figure it out to save my life.

    Here is what i am trying to accomplish. I want to show a link if a file exists on a remote server. That part works. The problem i am having is having the link actually open the dhtml window when the link appears.

    Its in php 5.3 now

    The script that works is this:

    [ICODE]<a href='#' onClick="readmewin=dhtmlwindow.open('README', 'iframe', 'file:////bas-vm01/iso/docs/CM11886.pdf', 'README for CM<?php echo $row_Master_Detail_Recordset['ID']; ?>.pdf ', 'width=500px,height=300px,center=1, resize=1'); return false">README</a>;[ICODE]

    so that link opens up the window and shows me the pdf. WONDERFUL!!

    Now the part that i need to work
    [CODE]
    <?php

    $id = $_GET['ID'];
    $path = '//bas-vm01/iso/docs/cm';
    $filename= $path.$id.'.pdf';


    if (file_exists($filename))

    echo '<a href="#" onClick="readmewin=dhtmlwindow.open(\'readme\', \'iframe\', \'$filename\', \'README for CM<?php echo $row_Master_Detail_Recordset[\'ID\']; ?>.pdf \', \'width=500px,height=300px,center=1, resize=1\'); return false">README</a>';

    else
    echo "The file $filename does not exist";
    ?>
    [CODE]

    So the link shows up if the file exists or the else statements shows up. So that part works.

    The part that doesn't work is the link to the dhtml window.

    PLEASE HELP!!! its gotta be something simple im sure LOL

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Your already in the php block and echoing so remove the <?php echo and the ?>.

    PHP Code:
    echo '<a href="#" onClick="readmewin=dhtmlwindow.open(\'readme\', \'iframe\', \'$filename\', \'README for CM' $row_Master_Detail_Recordset['ID'] . '.pdf \', \'width=500px,height=300px,center=1, resize=1\'); return false">README</a>'
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    HOLY COW!!! dang that was fast!!!

    and yes see!!! it was something so freakin simple.... LOL

    Bluewalrus You get a million points today...

    THANK YOU THANK YOU THANK YOU!!!

    FINAL CODE
    [CODE]
    <?php

    $id = $_GET['ID'];
    $path = '//bas-vm01/iso/docs/cm';
    $href = 'href="#"';
    $filename= $path.$id.'.pdf';

    if (file_exists($filename))
    {
    echo '<a href="#" onClick="readmewin=dhtmlwindow.open(\'readme\', \'iframe\', \'file:////bas-vm01/iso/docs/CM' . $row_Master_Detail_Recordset['ID'] . '.pdf \', \'README for CM' . $row_Master_Detail_Recordset['ID'] . '.pdf \', \'width=800px,height=600px,center=1, resize=1\'); return false">README</a>';
    }
    else {

    }
    ?>
    [CODE]
    Last edited by tooletime; 10-14-2010 at 08:05 PM. Reason: forgot code insert

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
  •