0

Any idea on how to integrate CakePHP 2.6 and ViewerJS into an iFrame?

The code below shows an empty ViewerJS frame.

If I try to show only the resource, it works. I have the right paths to ViewerJS and the file, but it still doesn't work.

<iframe src="<?php echo $this->webroot; ?>ViewerJS/#../<?php echo $atividade['Atividade']['caminho'] ?>" 
width='400' height='300' allowfullscreen webkitallowfullscreen></iframe>

2 Answers2

0

simple try this

$iframeUrl = WWW_ROOT."ViewerJS/#../".$atividade['Atividade']['caminho'];

<iframe src="<?php echo $this->Html->url($iframeUrl)?>" 
        allowfullscreen 
        webkitallowfullscreen
        height="400" 
        width="300">
</iframe>
Supravat Mondal
  • 2,574
  • 2
  • 22
  • 33
  • I tried this. But it shows an error inside the iFrame. "Error: VarController could not be found." And the ViewerJS frame disappeared. I also forgot to mention that I'm using CakePHP 2.6.2 – Bruno Souza Mar 04 '15 at 14:34
0

The only way I get it to work:

<?php
    $iframeUrl =$this->webroot;
    $iframeUrl.='app/ViewerJS/#../';
    $iframeUrl.=$atividade['Atividade']['caminho'];
?>

<iframe src="<?php echo $iframeUrl ?>"
    width='400' height='300'
    allowfullscreen
    webkitallowfullscreen>
</iframe>