By:Anonymous:dlassen ()  Nov 05 2009 11:14 am (Read 2987 times)  

Hi guys,

First of all thanks for a great CMS system and thanks for your just as excellent support! I was able to build and develop a musical collboration site for our band in around a week thanks to your help. Hopefully my questions will die down over time,but during the initial "deployment phase"I need your help.

Anyway,to the subject at hand:

Could you suggest a mod that allows pdf's to be opened in the media gallery on an in-line basis. I found a couple of posts on this but was unable to find any code snippets.

If I simply type


in a browser,the pdf opens in-line,but I was hoping to conceal the name and location of the file - something that is well outside of my php/html capabilities.

Any help would be appreciated.

Thanks again


By:lgarner (offline)  Nov 05 2009 12:24 pm  

I think if you store them in the File Manager instead of Media Gallery it'll work as you want. Media Gallery stores its file under the public directory while File Manager can be configured to store them outside of the web root.



Group Comfort

By:Anonymous:mst3kroqs ()  Nov 05 2009 13:52 pm  

Lots of ways to do this,although if you're asking glFusion itself to download PDF rendering code to the browser itself in order to display PDF in a glFusion-controlled content window,while that is possible,it's probably not practical.

With a little browser assistance,however,we can make it seem like glFusion is displaying the PDF inline.

First,we need to ensure that the appropriate Adobe plugin is installed for our browser that allows it to display PDF's inline. To test,click on a .pdf link and ensure that Adobe Acrobat/Reader appears inside the browser window,and displays the PDF.

OK,now let's create a staticpage. Name it "Display PDF",set the Page Format:to your preference,Comments Mode:"Disabled",Post Mode:"HTML Formatted",and ID:"display-pdf",or the like (doesn't matter,just needs to be memorable and unique for your system.

Now,cut/paste this code into the staticpage window:

PHP Formatted Code
global $_CONF;

//these iframe values can be overridden with page _REQUEST variables that are passed
$fb = 0;//frameborder - if set to 1,draws a broder around the iframe
$w = '100%';   //width - if set as percentage,auto-scales to available width,else you can set a fixed falue in pixels
$h = '800';   //height - in pixels
$mh = 0;   //marginheight
$mw = 0;   //marginwidth
$s = 'auto';   //scrolling frame?
$fp = '/files';  //base path to pdf's

//get the (sanitized) page parameters
foreach ($_REQUEST as $arg =>$value) $$arg = COM_applyFilter($value);

//we're looking for a $pdf filespec
if (empty($pdf)) {
  $html = 'No PDF file was specified.';
  return $html;

//make a url using the site url and basepath specified by $fp
$pdfurl = $_CONF['site_url'] . $fp . "/". $pdf;
//display the pdf in the iframe
$html = '<iframe src="' . $pdfurl . '"frameborder="' . $b . '"width="' . $w . '"height="'. $h . '"scrolling="' . $s . '"marginheight="' . $mh . '"marginwidth="' . $mw . '"></iframe>';

return $html;

Now,ensure that Centerblock:is unchecked,In a block:is unchecked,PHP:is "Execute PHP(return)",and then set your page access permissions as desired.

OK - now you have a little PDF engine that will display a PDF file (inline) in the centerblock area of your site,based upon the following invocation:

Note that you should edit the default basepath ($fp) above to be the correct root directory for PDF's relative to the root of your webserver,and yes - the PDF files need to be somewhere in the webroot for this simple 'shim'to work.

You could pretty easily modify this shim to load PDF's from other domains/sites,I'll leave that as an exercise to the reader.

Anyway - the trick here was to use the 'iframe'command to create a nice little 'virtual browser'which displays the PDF inline in the center block.

Now you could try downloading and installing the Autotag Plugin from,and see how you could create your own autotag which would allow for the easy creation of 'inline pdf links'in your site content.

For instance,you could create an autotag called "pdf-link"which invoked this staticpage like this:

Replacement:<a href="%site_url%/staticpages/index.php?page=display-pdf&pdf=%1%>%2%</a>"

Now,you could do something like this (I have to enclose this in code tags otherwise forum thinks I'm trying to use an undefined autotag on

PHP Formatted Code

You can [pdf-link:file-to-display.pdf click here] to view the PDF.

This just goes to prove that using glFusion is like playing country music backwards. You get your dog back,your truck back,your girlfriend back,and you even start getting younger by the day! Wink


By:Anonymous:mst3kroqs ()  Nov 05 2009 14:04 pm  

I should add/clarify - this is not a solution for Media Gallery,but it is a general-purpose solution for the site.

By:Anonymous:dlassen ()  Nov 05 2009 18:29 pm  

Thanks Mark - before I start exploring your suggestions,I have one question regarding this remark:

I should add/clarify - this is not a solution for Media Gallery,but it is a general-purpose solution for the site.

Do you mean that the suggested mod will work in general on the site AND within media gallery or will this specifically NOT work in MG?

The reason I ask is that we are building a repository of audio files,embedded videos (youtube),video files and charts and other documents (primarily pdf's) and would like to house everything in the same "database"(i.e. MG).

An alternative might have been the File Management plugin,however I don't think one can launch video/audio files from there (although I may be wrong).

Thanks in advance,


By:Anonymous:mst3kroqs ()  Nov 05 2009 19:06 pm  

Unfortunately,this will not help you if you are storing the PDF's in MediaGallery.

6 posts ::Page 1 of 1
All times are CDT. The time is now 01:06 pm.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic w/New Post Sticky Topic w/New Post
Locked Topic w/New Post Locked Topic w/New Post