setHtml5(true); $doc->setTitle('My New Document'); $doc->addScript('/path/to/javascript.js'); $doc->addStylesheet('/path/to/styles.css'); echo $doc->render(); ?>
setMetaData('keywords', 'my,awesome,keywords'); $doc->setMetaData('description', 'My awesome page description'); echo $doc->render(); ?>
createHTMLElement('div'); $div->setAttribute('id', 'my-new-div'); $div->addChild('p', 'This is my new div!'); $doc->getBody()->addChild($div); echo $doc->render(); ?>In this example, we load the Joomla library and then get the existing document object using JFactory. We then create a new HTML element using the createHTMLElement() method and set some attributes on it. We also add some child elements to the new div using the addChild() method. Finally, we add the new div to the body of the document using the addChild() method again, and then render the document to output it to the browser. Package Library: Joomla CMS