NightLightW
Active Member
Hello,
I`m using
Display PDF using Thickbox in a WordPress plugin. Plugin work great until you put three pdf file in one page and then will show you only one(first pdf file link - this mean when you click on other link you will se only the first pdf document other is not showed). So i found this code to show multiple pdf`s
then i click update. and i have this error on my screen
here is orginal code
I`m using
Display PDF using Thickbox in a WordPress plugin. Plugin work great until you put three pdf file in one page and then will show you only one(first pdf file link - this mean when you click on other link you will se only the first pdf document other is not showed). So i found this code to show multiple pdf`s
Code:
function ilc_pdfbox_thecontent ($content){
global $post;
global $pdfbox_width;
global $pdfbox_height;
$pdfbox_height_plus = $pdfbox_height + 15;
$pdfbox_height += 35;
$pattern = "/<a>]*).(pdf)('|\")(.*?)>(.*?)/i";
$replacement = '<a href="#TB_inline?height='.$pdfbox_height.'&width='.$pdfbox_width.'&inlineId=ilc_pdfbox_##" rel="nofollow">Launch PDF file.</a>
';
preg_match_all($pattern,$content,$matches);
foreach($matches[0] as $k=>$v){
$new_v = preg_replace($pattern, $replacement, $v);
$new_v = preg_replace("!##!", $k, $new_v);
$content = preg_replace("!".preg_quote($v)."!", $new_v, $content);
}
return $content;
}
here is orginal code
Code:
function ilc_pdfbox_thecontent ($content){
global $post;
global $pdfbox_width;
global $pdfbox_height;
$pdfbox_height_plus = $pdfbox_height + 15;
$pdfbox_height += 35;
$pattern = "/<a(.*?)href=('|\")([^>]*).(pdf)('|\")(.*?)>(.*?)<\/a>/i";
$replacement = '<a href="#TB_inline?height='.$pdfbox_height.'&width='.$pdfbox_width.'&inlineId=ilc_pdfbox_content" class="thickbox pdfbox">Launch PDF file.</a>
<div id="ilc_pdfbox_content" style="display:none;"><iframe class="ilc_pdfbox_iframe" src="$3.$4" style="height:'.$pdfbox_height_plus.'px;"></iframe></div>';
$content = preg_replace($pattern, $replacement, $content);
//}
return $content;
}
Last edited: