1. Go to this page and download the library: Download heimrichhannot/contao-share library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
heimrichhannot / contao-share example snippets
// Module class:
public function compile()
{
...
$this->generateShare();
...
}
protected function generateShare()
{
if ($this->addShare)
{
$objShare = new \HeimrichHannot\Share\Share($this->objModel, [Entity to print]);
$this->template->share = $objShare->generate();
}
return null;
}
// Template file:
<?= $this->share
// Add this to the generateShare method from above, after calling generate():
if ($this->module->share_addTemplateLinks)
{
$this->template->shareUrls = $objShare->generateShareUrls();
}