Assigning tags for uploaded HTML files in Concrete5

145 views Asked by At

We are planning to load a number of HTML files as they are in the site using Concrete5. We had to do this since the number of files is too big to load them via editor. (We are going to generate the html files with madcap flare)

However, I need to use the tag feature of concrete5 for the contents loaded by this method. I am told by my developers that this is impossible.

Does anyone know how to use tags for files loaded without going through the C5 editor?

i.e. I want the contents in the manually linked html files to be searched and filtered within the site with the search feature and filter feature provided by C5

HELP!!

1

There are 1 answers

0
Phil Lello On

I recommend creating a very simple template consisting of the standard C5 header/footer code, with one big block as the contents of the body tag.

You can then import the pages by something along the lines of (pseudo-code):

$parent = Page::getByCollectionPath('/');
$ct = CollectionType::getByHandle('template_name');
$data = array(
  'cName' => 'The page title',
  'cHandle' => 'The trailing path component'
);
$page = $parent->add($ct, $data);
$blocks = $page->getBlocks('Main');
// Gross hack because the template has one block, and that a 'content' block
$blocks[0]->update('content', 'IMPORTED HTML BODY CONTENT');

After that, you can add tags either via the API or the Dashboard.