These are chat archives for PHPOffice/PHPPresentation

1st
Sep 2017
dvdbot
@dvdbot
Sep 01 2017 13:44

Hey, when trying to run the following code:

require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Slide;
use PhpOffice\PhpPresentation\Shape\RichText;

$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('resources/Digital Signage.pptx');

$oTree = new PhpPptTree($oPHPPresentation);
echo $oTree->display();

I get an error about:

Fatal error: Uncaught Error: Class 'PhpPptTree' not found in \index.php:18 Stack trace: #0 {main} thrown in \index.php on line 18

Thomas Citharel
@tcitworld
Sep 01 2017 13:45
Is there anything inside vendor/ ?
dvdbot
@dvdbot
Sep 01 2017 13:45
Yes there is, I installed everything using Composer like said on this page: http://phppresentation.readthedocs.io/en/latest/installing.html#using-composer
Thomas Citharel
@tcitworld
Sep 01 2017 13:47
PhpPptTree should be imported.
Probably something like
use PhpOffice\PhpPresentation\PhpPptTree
Check the correct path inside the sources
dvdbot
@dvdbot
Sep 01 2017 13:48

code is now:

require_once 'vendor/autoload.php';

use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\Slide;
use PhpOffice\PhpPresentation\Shape\RichText;
use PhpOffice\PhpPresentation\PhpPptTree;

$pptReader = IOFactory::createReader('PowerPoint2007');
$oPHPPresentation = $pptReader->load('resources/Digital Signage.pptx');

$oTree = new PhpPptTree($oPHPPresentation);
echo $oTree->display();

Still getting error:

Fatal error: Uncaught Error: Class 'PhpOffice\PhpPresentation\PhpPptTree' not found in D:\Projects\PHPStorm\VosSignage\index.php:19 Stack trace: #0 {main} thrown in D:\Projects\PHPStorm\VosSignage\index.php on line 19

I'm using PHPStorm, that shouldn't be a problem, right?
For testing, it runs in AMPPS
dvdbot
@dvdbot
Sep 01 2017 13:51
I haven't included the sample_header because I thought it is just a simple header file
Thomas Citharel
@tcitworld
Sep 01 2017 13:51
Well, it's the one that does all the display stuff.
dvdbot
@dvdbot
Sep 01 2017 13:52
I'll try creating a header file
Thomas Citharel
@tcitworld
Sep 01 2017 13:52
PHPPresentation is just a object representing the presentation data, it doesn't have any methods or so to render itself.
dvdbot
@dvdbot
Sep 01 2017 13:52
Ah, good to know
Thomas Citharel
@tcitworld
Sep 01 2017 13:53
That's why in the sample there's this header file that's used in all samples.
dvdbot
@dvdbot
Sep 01 2017 13:56
Is it possible to actually show the presentation itself?
Thomas Citharel
@tcitworld
Sep 01 2017 13:57
Well, if you have exactly the same thing as the sample, yes.
dvdbot
@dvdbot
Sep 01 2017 13:57
It just shows a tree structure
Thomas Citharel
@tcitworld
Sep 01 2017 13:57
Maybe there's a better sample, but you have to work everything else, yeah
dvdbot
@dvdbot
Sep 01 2017 13:58
My goal is to actually play a powerpoint presentation, this is possible right?
Thomas Citharel
@tcitworld
Sep 01 2017 13:58
no
not that i know of
dvdbot
@dvdbot
Sep 01 2017 13:59
Oh I thought that PHPOfficePHPPresentation was made for that
My mistake
Thomas Citharel
@tcitworld
Sep 01 2017 14:00
PHPOffice is a toolbox / library to work with files, not a ready-to-use app
dvdbot
@dvdbot
Sep 01 2017 14:01
I know, but I thought it was capable of playing a powerpoint presentation with animations in the browser
Thomas Citharel
@tcitworld
Sep 01 2017 14:01
Nah. I wanted to work on that to import .ppt into Framaslides, but never got the time.
If you want animations in the browser and all that sort of stuff, checkout impress.js, but it's only html
dvdbot
@dvdbot
Sep 01 2017 14:02
Ah, thanks for your time then but this isn't what I'm looking for.
Thanks for the info, I'll take a look, have a nice day
Progi1984
@Progi1984
Sep 01 2017 14:10
@tcitworld Thanks for the support :)
Thomas Citharel
@tcitworld
Sep 01 2017 14:22
o/