Jump to content

PhpPresentation (.ppt generator) installation require_once lines - where do they go?


Recommended Posts

[PhpPresentation was formerly called PhpPowerpoint but renamed to avoid any issues with Microsoft.]

The installation instructions, https://phppowerpoint.readthedocs.io/en/stable/installing.html, give the following instructions:

Quote

Manual install

To install manually, download PHPOfficePHPPresentation package from GitHub and download PHPOfficeCommon package from GitHub. Extract the package and put the contents to your machine.

require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; 
\PhpOffice\PhpPresentation\Autoloader::register(); 

require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php'; 
\PhpOffice\Common\Autoloader::register();

I've downloaded and unzipped the files onto my cPanel (reseller account - so no CLI).

Where do I put the lines of code? There are no instructions on the site.

Many thanks.

 

 

On 11/24/2024 at 5:19 AM, Transistor said:

[PhpPresentation was formerly called PhpPowerpoint but renamed to avoid any issues with Microsoft.]

The installation instructions, https://phppowerpoint.readthedocs.io/en/stable/installing.html, give the following instructions:

require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; 
\PhpOffice\PhpPresentation\Autoloader::register(); 

require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php'; 
\PhpOffice\Common\Autoloader::register();

I've downloaded and unzipped the files onto my cPanel (reseller account - so no CLI).

Where do I put the lines of code? There are no instructions on the site.

Many thanks.

 

 

They usually go in the top of the php file where you want to use them. For example, if you want them in index.php, you open index.php and paste them at the top:

<?php
// index.php
require_once 'path/to/PhpPresentation/src/PhpPresentation/Autoloader.php'; 
\PhpOffice\PhpPresentation\Autoloader::register(); 

require_once 'path/to/PhpOffice/Common/src/Common/Autoloader.php'; 
\PhpOffice\Common\Autoloader::register();

// and whatever after that
?>

Just change the paths to reflect the file locations.

Thanks, guys. I didn't get back to this for a week.

I found that there was an error in the folder names after unpacking the files. The sample files all include `Sample_Header.php` (located in the samples folder. This has the lines,

 if (is_file(__DIR__ . '/../../Common/src/Common/Autoloader.php')) {
    include_once __DIR__ . '/../../Common/src/Common/Autoloader.php';
    PhpOffice\Common\Autoloader::register();
} else {
    throw new Exception('Can not find the vendor or the common folder!');
}

but the extraction of the install files created `Common-master`. Renaming the higher-level folder to `Common` seems to have resolved the problem.

Hopefully this will help someone else.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.