PHP code example of flexpress / component-shortcode
1. Go to this page and download the library: Download flexpress/component-shortcode 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/ */
flexpress / component-shortcode example snippets
$pimple["documentLinkShortcode"] = function () {
return new DocumentLink();
};
$pimple['ShortcodeHelper'] = function ($c) {
return new ShortcodeHelper($c['objectStorage'], array(
$c["documentLinkShortcode"]
));
};
class DocumentLink extends AbstractShortcode {
public function getName()
{
return "document_link";
}
public function getCallback()
{
$link = func_get_arg(0);
return '<a href="' . $link . '">Download document</a>';
}
}