Output Functions - gtbu/Typesetter5.2 GitHub Wiki

There are a variety of output functions available to theme builders. Some you'll need to include for proper site functioning, while others can be mixed.

Necessary Functions in Themes

<?php $page->GetContent(); ?>
This function outputs the primary content of each page.
<?php gpOutput::GetHead(); ?>
This function will output the necessary meta, style and link information found in the <head> tag of the html document.
<?php gpOutput::GetAdminLink(); ?>
This function will output the Login link so users can log in as administrators.

Menu Output

<?php gpOutput::Get('Menu'); ?>
Outputs only the top level links.
<?php gpOutput::Get('FullMenu'); ?>
Outputs all links within the user's menu.
<?php gpOutput::Get('SubMenu'); ?>
Outputs all 2nd and 3rd level links within the selected group.
<?php gpOutput::Get('ExpandMenu'); ?>
Outpus all 1st level links and the 2nd and 3rd level links within the selected group.
<?php gpOutput::Get('ExpandLastMenu'); ?>
Outputs all 1st and 2nd level links and the 3rd level links within the selected group.
<?php gpOutput::Get('TopTwoMenu'); ?>
Outputs all the 1st and 2nd level links.
<?php gpOutput::Get('BottomTwoMenu'); ?>
Outputs all the 2nd and 3rd level links.
<?php gpOutput::Get('MiddleSubMenu');  ?>
Outputs only the 2nd level links when the 1st level parent is selected.
<?php gpOutput::Get('BottomSubMenu');  ?>
Outputs only the 3rd level links when the 2nd level parent is selected.

Additional menu formatting options are available.

HTML Content Areas

<?php gpOutput::Get('Extra',string $area); ?>
Where $area is the name of a content area. 'Header', 'Footer', 'Side_Menu' are all standard areas. Additional areas can be added just by changing the value of area.

You can find a brief tutorial on how to add unique header and/or side menu on a per page basis in the forum here: [1].

Images

<?php gpOutput::GetImage( string $image_path , array $html_attributes ); ?>
New in Typesetter 3.5b2, the GetImage() function allows designers to add images to themes in a way that allows end users to easily edit and customize the image. Outputs an <img /> tag.
$image_path
The path to the image relative to the theme's root folder. If the image is located in at /themes/theme_name/theme_color/image.png, then the path for the image would be /theme_color/image.png.
$html_attributes
An array of html attributes to be used in the <img /> tag. Note: Typesetter uses the id attribute for inline editing.

Text Areas

<?php gpOutput::Area(string $area_name, string $html); ?>
...
<?php gpOutput::GetArea(string $area_name, string $area_text);  ?>
These two can be used used in combination to define and output a draggable area with custom html and editable text.

This line of code defines an area named My_Html_Area that contains the html <div class="my_html_area">%s</div>

gpOutput::Area('My_Html_Area','<div class="my_html_area">%s</div>');

Then using this line of code, we can retrieve that html, in a user draggable wrapper with editable text.

gpOutput::GetArea('My_Html_Area','This Text');

The result will be an area in your template that a user can do two things with:

  • Edit the text "This Text"
  • Drag 'n drop the whole area to their desired location within their theme.

Note: gpOutput::Area() should be called before any other output functions are used in your template. Before <head>label and enclosed on php calls

Designing for Arrangeable Content

By default, most of the areas outlined above can be rearranged by the user within Typesetter's administration scripts. To prevent users from being able to move an area in your theme, you can precede the function call with $GP_ARRANGE = false;. Example:

$GP_ARRANGE = false;
gpOutput::Get('Menu');

 

⚠️ **GitHub.com Fallback** ⚠️