PHP code example of fromholdio / silverstripe-dbhtmlanchors
1. Go to this page and download the library: Download fromholdio/silverstripe-dbhtmlanchors 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/ */
fromholdio / silverstripe-dbhtmlanchors example snippets
private static $db = [
'Content' => 'HTMLText'
];
// CORRECT
$contentField = $this->dbObject('Content');
$anchors = $contentField->getAnchors();
// WRONG
$contentField = $this->Content;
$anchors = $contentField->getAnchors();
// return value from ->getAnchors()
[
'sectionone' => 'sectionone',
'sectiontwo' => 'sectiontwo'
]