Ferreteria/v2/usage/browser

From Woozle Writes Code
< Ferreteria‎ | v2‎ | usage
Revision as of 13:34, 4 March 2017 by htyp>Woozle (a few basic things)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to generate browser output depends on what kind of output you want to generate.

Page Content

<php>fcApp::Me()->AddContentString('your content here');</php>

Page Title

There are actually two kinds of page title:

  • browser title: what the browser shows in its window frame
  • content title: text displayed in a standard prominent format at the top of the page, sometimes with a menu

It's usually best to set them both to essentially the same thing, which can be done like this:<php>fcApp::Me()->GetPageObject()->SetPageTitle('Your Title');</php>

To set the browser title:<php>fcApp::Me()->GetPageObject()->SetBrowserTitle('Your Title');</php>

To set the content title:<php>fcApp::Me()->GetPageObject()->SetContentTitle('Your Title');</php>

Ferreteria can be configured (by descending from fcPage_standard) to automatically insert your site's name or other text in the browser title (as an indicator that these pages are on your site) while leaving the content title exactly as requested.

We have found that it's better to show the set title (the string you request for the title, which should describe the specific page you're displaying) before the site name, because tabs can be displayed in such a way that only the first part of the title text is visible, and the site name can easily take up all of the available space, leaving no way to distinguish between pages at a glance. A better way to indicate site ownership of tabs is to have a distinctive favicon, though there's no harm in also having your site name after the page descriptor.

Section Headers

Section headers are created from scratch:<php>$oHdr = new fcSectionHeader('Section Title',$oMenu);</php>

The $oMenu parameter is optional. The Section Header object must be rendered in order to show up on the page:<php>fcApp::Me()->AddContentString($oHdr->Render());</php>

Header Menus

The content header (which includes the content title) has its own menu object, which you retrieve like this:<php>$oMenu = fcApp::Me()->GetHeaderMenu();</php>

To add a menu to a section header, just create a new menu object (from scratch) before you create the section header object: <php>$oMenu = new fcHeaderMenu(); $oHdr = new fcSectionHeader('Section Title',$oMenu);</php>

In either case, you can then add items to the $oMenu object, which will be rendered when $oHdr is rendered.