Page 1 of 1

pdf include

Posted: Fri 17. Jun 2005, 11:56
by Findus
Hi,

my first replacementtag. :D This include a pdf file inside the content. :!:

Use a plain text content:

Code: Select all

{PDFINCLUDE:link/to/pdf/file/test.pdf}
this are the changes:

in /include/inc_front/content.func.inc.php

Code: Select all

// -------------------------------------------------------------

// PDFINCLUDE:alias replacement (by Thomas Bornhaupt, 2005)
$content["all"] = preg_replace('/\{PDFINCLUDE:(.*?)\}/ie', 'get_pdfinclude_content("$1");', $content["all"]);

// -------------------------------------------------------------

in /include/inc_front/front.func.inc.php

Code: Select all

// -------------------------------------------------------------

function get_pdfinclude_content ($url) {
   $ret = '<iframe src="';
   $ret .= $url;
   $ret .= '"  width="800px" style="height:800px">';
   $ret .= '<embed src="';
   $ret .= $url;
   $ret .= '" width="800px" height="800px"></iframe>';

   return $ret;
}
Testet with phpwcms v1.2.1-DEV, firefox and IE6.

Wishes: CSS for this replacement. Any idear :?:

Posted: Fri 17. Jun 2005, 17:32
by pico
Hi

try to follow the Rules for 'own'-REP-Tags and put the Code into ./phpwcsm_template/inc_script/frontend_render or frontend_init - there is no need to touch the Source-Code. :lol: :wink:

Posted: Fri 17. Jun 2005, 18:47
by Findus
Hi,

so put all this line

Code: Select all

<?php

// PDFINCLUDE:alias replacement (by Thomas Bornhaupt, 2005)
$content["all"] = preg_replace('/\{PDFINCLUDE:(.*?)\}/ie', 'get_pdfinclude_content("$1");', $content["all"]); 

// -------------------------------------------------------------

function get_pdfinclude_content ($url) {
   $ret = '<iframe src="';
   $ret .= $url;
   $ret .= '"  width="800px" style="height:800px">';
   $ret .= '<embed src="';
   $ret .= $url;
   $ret .= '" width="800px" height="800px"></iframe>';

   return $ret;
}

?>
in ./phpwcsm_template/inc_script/frontend_render/phpinclude.php

Every day there is something to learn. :D

The replamenttag is

Code: Select all

{PDFINCLUDE:link/to/pdf/file/test.pdf}

Posted: Fri 17. Jun 2005, 18:53
by cyrano
Hi findus,

great rt! thank you for sharing.

are you familar with making pdf files from pages too?

would be another great enhancement for wcms.

Posted: Fri 17. Jun 2005, 19:18
by Findus
years ago i buy

pdfFactory

from http://www.fineprint.com/

Posted: Fri 17. Jun 2005, 19:23
by pico
:wink: that's the right way

great Job :D

Posted: Fri 17. Jun 2005, 19:33
by cyrano
nice to know this findus - thank you.

have seen just for windows server, no linux...

ok, sometimes it will works...