Viewing 1 replies (of 1 total)
  • Thread Starter Tanveer

    (@tanver)

    I just changed the code – took away the shortcode – and it had worked for me, am putting the code here as it might help someone else, the complete code for the PHP Code Widget is ..

    <?php
    $chArr[] = '-';
    $chArr[] = '.pdf'; 
    
    if ($handle = opendir('pdfdocs')) {
      while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            $pdfdocs[] = $file;
        }
      }
      closedir($handle);
    }
    ?>
    
    <?php
    echo '<ul>';
    foreach($pdfdocs as $pdfdoc) {
      //echo '<li> [pdf href="https://floodreliefpakistan.com/pdfdocs/'.$pdfdoc.'"]View '.str_replace($chArr, " ", $pdfdoc).'[/pdf]</li>';
    ?>
      <li> <a class="pdf" href="https://docs.google.com/viewer?url=https://floodreliefpakistan.com/pdfdocs/<?php echo $pdfdoc; ?>">View <?php echo str_replace($chArr," ", $pdfdoc); ?></a></li>
    <?php
    }
    echo '</ul>';
    unset($pdfdocs);    // it's gone
    ?>

    hope it helps someone.

    The one thing still left desirable is that I would like the google’s document window to open in a new window instead of appearing in the same window.
    TIA

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: PHP Code Widget] Generated [pdf] short code not working ..’ is closed to new replies.