IDEA/CONCEPT/THEORY: Do you have a newsletter in a PDF that you would like to display online?
DEPENDENCY - You will need the "Simple PHP Block" Add-on installed first to do this: http://www.concrete5.org/marketplace/addons/simple-php-block/...
Caveat to this is that your users maybe prompted for page coming from secure page
There maybe other resources to do this too and I am open to suggestions, etc.
Loader::model("file_set");
Loader::model('file_list');$fs= FileSet::getByName('My File Set');$fl=new FileList();$fl->filterBySet($fs);$fl->sortByFileSetDisplayOrder($gs);$files=$fl->get();//CHANGE SORT ORDER? Comment out the next line to show the first file in set$files=array_reverse($files);//It is possible to do this by Date, Title, etc. but willl do this by set$i=0;foreach($filesas$f)if($i<1){$url= View::url('/download_file/view_inline',$f->getFileID(),$cID);$url='http://docs.google.com/viewer?url='.urlencode(BASE_URL . DIR_REL .$url);echo"<p><h1>CURRENT ISSUE OF OUR NEWSLETTER</h1>";
Loader::model("file_set");
Loader::model('file_list');$fs= FileSet::getByName('My File Set');$fl=new FileList();$fl->filterBySet($fs);$fl->sortByFileSetDisplayOrder($gs);$files=$fl->get();//CHANGE SORT ORDER? Comment out the next line to show the first file in set$files=array_reverse($files);//It is possible to do this by Date, Title, etc. but willl do this by set$i=0;foreach($filesas$f)if($i<1){$url= View::url('/download_file/view_inline',$f->getFileID(),$cID);$url='http://docs.google.com/viewer?url='.urlencode(BASE_URL . DIR_REL .$url);echo"<p><h1>CURRENT ISSUE OF OUR NEWSLETTER</h1>";echo"<iframe src=".$url."&embedded=true width=100% height=780></iframe>";$i+=1;}
Ran into an issue with IE. IE does not like Google Viewer, or Zoho Viewer for that matter in an IFRAME. You will probably want to do the following, but does require that the user have a PDF reader installed.
Loader::model("file_set");
Loader::model('file_list');$fs= FileSet::getByName('My File Set');$fl=new FileList();$fl->filterBySet($fs);$fl->sortByFileSetDisplayOrder($gs);$files=$fl->get();//Comment out the next line to show the first file$files=array_reverse($files);//It is possible to do this by Date, Title, etc. but willl do this by set$i=0;foreach($filesas$f)if($i<1){$url= View::url('/download_file/view_inline',$f->getFileID(),$cID);echo"<h1>CURRENT NEWSLETTER</h1>";echo"<iframe src=". BASE_URL . DIR_REL .$url." width=100% height=780></iframe>";
Loader::model("file_set");
Loader::model('file_list');$fs= FileSet::getByName('My File Set');$fl=new FileList();$fl->filterBySet($fs);$fl->sortByFileSetDisplayOrder($gs);$files=$fl->get();//Comment out the next line to show the first file$files=array_reverse($files);//It is possible to do this by Date, Title, etc. but willl do this by set$i=0;foreach($filesas$f)if($i<1){$url= View::url('/download_file/view_inline',$f->getFileID(),$cID);echo"<h1>CURRENT NEWSLETTER</h1>";echo"<iframe src=". BASE_URL . DIR_REL .$url." width=100% height=780></iframe>";$i+=1;}
Thanks,
Kent
Code
Post Reply
Delete Post
You are allowed to delete your post for 5 minutes after it's posted.
Thanks,
Kent