English, Nederlands
Donate with PayPal

API Reference

Introduction

Nocterra provides an application programming interface (API) that can be used on any page. The Nocterra API contains functions to easily enhance and customize the generated webpages on a per page basis. This documentation is both a user guide for content writers and developers who wish to enrich the generated content and perform tasks like SEO.

The API reference is not complete; it's an ongoing effort documenting the API and providing examples to document the use of the functions. Please also see the Nocterra Manual for a description of the functional principles and more comprehensive examples.

Table of Contents

addKeywords

Description
addKeywords(array|string $newKeywords): void
addKeywords(array|string $keywords, array|string $newKeywords): void

Add new keywords to the keywords already set for the current page.

Or add new keywords to the given keywords and set thiese new keywords to the current page.

Both function variants do not add new keywords to the keywords it alread present. So calling this function like addKeywrds('foo', 'bar'); on a page which already has the foo keyword set will only add the bar keyword.

Parameters
keywords
The keywords to add new keyhwords to. Either a comma separated list of keywords or an array of keywords.
newKeywords
The new keywords to add. Either a comma separated list of keywords or an array of keywords.
Return value

No value is returned.

See Also

addMenuItem

Description
addMenuItem(
string $menuItem,
string $language,
string $link,
string $name
): void

Add an item to the menu in the specified language. Menu items are specified by their structure in the menu. foo would be the foo menu at the top most level. foo/bat would be the bar submenu as a child of the foo menu.

For multilingual websites an menu can be added for each language. When a language does not have a menu item added for the $menuItem during URL generation an URL will be generated to the deepest menu item that is present in that language, either by defining it in the configuration or added through this function.

If a menu item has presivously been added for $menuItem the link and name will be overridden other set values will persist.

Parameters
menuItem
The menu item to add as a slash separated list.
language
The language to add an menu item for.
link
The local or external uRL to link to.
name
The name to display in the navigation and breadcrumbs.
Return value

No value is returned.

See Also

setDescription

Description
setDescription(string $description): void

Sets the meta description for the current page. This description is used for SEO, as the text when people link to the page in Facebook and for Twitter cards.

Parameters
description
The description to set.
Return value

No value is returned.

See Also

setEpilogue

Description
setEpilogue(string $epilogue): void
setEpilogue(string $epilogue, string $location): void

Sets the epilogue for the current page.

An epilogue is a user defined piece of HTML that will be inserted at the end of a page element. It is inserted after the content generated by Nocterra.

The location parameter specifies which element in the page the epilogue will be inserted. When not specified, it's at the end of the page body.

Parameters
epilogue
The epilogue to set.
location
The location in the page to set the epilogue to.
Return value

No value is returned.

See Also

setKeywords

Description
setKeywords(string $keywords): void

Sets, as in replaces, the keywords for the current page.

Parameters
keywords
The keywords to set.
Return value

No value is returned.

See Also

setPrologue

Description
setPrologue(string $prologue): void
setPrologue(string $prologue, string $location): void

Sets the prologue for the current page.

An prologue is a user defined piece of HTML that will be inserted at the start of an page element. It is inserted before the content generated by Nocterra.

The location parameter specifies which element in the page the prologue will be inserted. When not speicifed, its at the start of the page body.

Parameters
prologue
The prologue to set.
location
The location in the page to set the prologue to.
Return value

No value is returned.

See Also

setSubtitle

Description
setSubtitle(string $subtitle): void

Sets the subtitle for the current page.

Parameters
subtitle
The subtitle to set.
Return value

No value is returned.

See Also

setTitle

Description
setTitle(string $title): void

Sets the title for the current page.

Parameters
title
The title to set.
Return value

No value is returned.

See Also