Jump to content

API how to output notes in templates (Quick guide)


Juergen
 Share

Recommended Posts

Today I had to output notes in a form at the frontend.

This little code snippets show you how it can be done via the API:

1) One language site:

$notesofmyfield = $page->fields->get("myfield")->notes;
echo $notesofmyfield;

2) On a multilanguage site

if ($user->language->name != 'default') {
    $notes       = "notes{$user->language}";
} else {
    $notes       = 'notes';
}
$notesofmyfield = $page->fields->get("myfield")->$notes;
echo $notesofmyfield;

Happy coding!!

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...