All of the following examples in this section assume that $document is the global
document object.
Chapter 9
[ 259 ]
Page Title
The page title is the most commonly modified part of the page. The title is the
contents of the title tag that is located in the XHTML head tag.
There are two methods related to the title: getTitle() and setTitle(). The
getTitle() method retrieves the existing title; setTitle() sets the title to a
new value.
This example demonstrates how we use setTitle() to make the title 'Some
Exciting Title'.
$document->setTitle(JText::_('Some Exciting Title'));
Notice that we use JText to translate the title before passing it. This is because the
setTitle() method does not translate new titles for us.
We never have to set the document title. If we don't, the site name
will be used.
It's not uncommon to use the two methods in conjunction. This way we can append
title information. This is such an example:
$title = $document->getTitle().' - '.JText::_('Some Exciting Title')
$document->setTitle($title);
Pathway/Breadcrumb
The pathway, also known as the breadcrumb (trail), describes to the user their
current navigational position in a website.
Pages:
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355