Skip to content

Dynamic PHP filepath to access ViewerJS from anywhere in the file system #314

@Penworks

Description

@Penworks

Im hosting ViewerJS in a web domain subfolder that uses an https subdomain, and trying to use ViewerJS from anywhere in the child folder system. I tried moving ViewerJS to the web root (domain document root) but this makes no difference. Im using an if/else statement for now for two levels and this works, but clearly is not adequate for future folders that might be created. I expect the folder tree to extend 4 levels. ANny ideas on how to make the if/else a dynamic dir/file call gratefully received. Im not a PHP coder, Im just a google hacker.

|--subdomain root
  |--file.pdf
  |--file.pdf
  |--file.pdf
      |--folder2
         |--file.pdf
         |--file.pdf
      |--folder3
         |--file.pdf
         |--file.pdf
         |--file.odp
             |--folder4
                |--file.pdf
                |--file.pdf
|--ViewerJS (folder)


if ($online_viewer == 'viewerjs') {

                            if ($current_path == 'subdomain root'){
                                echo '<iframe src="/ViewerJS/#../' . fm_enc($file) . '" frameborder="no" style="width:100%;min-height:460px" allowfullscreen webkitallowfullscreen></iframe>';
                            } else {
                               echo '<iframe src="/ViewerJS/#../' . fm_enc($current_path) . '/' . fm_enc($file) . '" frameborder="no" style="width:100%;min-height:460px" allowfullscreen webkitallowfullscreen></iframe>';
                            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions