gpEasy CMS Output Functions

gpEasy CMS uses specific output functions for it's themes. While there are several output functions available to use there are only three that are required for a working theme and five in total that we really care about. The main purpose of this tutorial is to get you familiar with gpEasy's output functions. In a later tutorial we'll go into creating a theme and I'll show you how to place them properly in your template.php file for your theme. For now just know what the main ones are and what they do.

Required Output Functions

<?php gpOutput::GetHead(); ?>
The GetHead output function must be placed between the opening <head> tag and the closing </head> tag. The GetHead function retrieves and outputs all the necessary meta data, styling links, JS links, etc. that are required to be in the head area of your template. This is a very nice feature in gpEasy CMS because it takes care of all your <head> meta data and linking unlike many content management systems that use a lot of php to carry out those functions. We just have one simple gpEasy specific output function!

<?php $page->GetContent(); ?>
The GetContent output function has been discussed slightly in the styling page content tutorial. The GetContent function outputs the main content of a page/file. Generally this is the center area of your web page where that particular page's information is contained.

<?php gpOutput::GetAdminLink(); ?>
The GetAdminLink function is required in order to be logged into gpEasy. If this function is missing you will be logged out as soon as you log in. In other words, you will not be able to edit your site at all. I've covered this output function slightly in the styling admin links tutorial. This function will output the login & logout links as well as the site map link. Most theme developers tend to place the GetAdminLink in the footer of their theme though it can be placed anywhere.

Extra Content Areas Output Function

gpEasy has several optional output functions however with the release of gpEasy CMS 1.7 there really is only one other output function that we need to concern ourself with, the "Get Extra Content Areas" output function: <?php gpOutput::Get('Extra',[area]); ?>.

This function is used in the theme to define where Extra Content Areas can be added. With the release of gpEasy 1.7 all we need in the theme is an extra content area output function and we can add or remove menus of any type and extra content areas of any type. However, you generally want to name it properly in your theme so it will load the default content areas.

Notice the [area] in the output function? This is where the name of the extra content area goes. For example, I want to output the extra content area for the header: <?php gpOutput::Get('Extra','Header'); ?>. This would output the extra content area file named "Header" wherever I place this output function in the theme, generally where the header should be. Remember that the user can always edit the extra areas and change them to whatever they like via the edit layouts feature. We just want to make sure we are using the "default" names of the extra areas that come preloaded with gpEasy CMS.

Default Extra Content Areas

There are three default extra content areas that you want to be aware of; Header, Footer, and Side_Menu. The extra content area files are located in the /data/_extra/ folder within your gpEasy installation. These three come pre-installed with gpEasy. Of course you can always change them, rename them, and even delete them.

You will want to place the properly named output function for each one of these in the proper area of your theme where you want them to be output. This way when someone else uses your theme the defaults will load instead of nothing.

Examples:
<?php gpOutput::Get('Extra','Header'); ?> = outputs the extra "Header" file.
<?php gpOutput::Get('Extra','Footer'); ?> = outputs the extra "Footer" file.
<?php gpOutput::Get('Extra','Side_Menu'); ?> = outputs the extra "Side_Menu" file.

Menu Output Functions

With the release of gpEasy CMS 1.7 the menus have undergone considerable change. Prior to 1.7 you needed an output function for the menus within your theme. Now they can be added simply by editing the layouts as long as there is an extra content area output function or menu output function. Nonetheless you may still want to use a menu output function in your theme where you want to make certain that a menu is called as the default setting versus an extra content area. In that case I suggest using the <?php gpOutput::Get('Menu'); ?> output function. This will output the top level links and users can change it via edit layouts. You can read about the other menu output functions at the gpEasy documentation wiki for output functions.

Personally I only use the menu output functions where only a menu should go otherwise I use the extra content area output function and let the user insert the menu via editing the layout. However, you can do just the opposite as well. Use only menu output functions and let the user replace those with extra content areas. It's just a preference of how you want your theme to look by default.

While there are several menu output functions there really is no need to use them since the release of gpEasy CMS 1.7. The 'Menu' function gives you the top level links and 'FullMenu' will display all links. Those are most likely the only two you will ever use.

Other Output Functions

There are a couple other output functions and you can read about them at the gpEasy wiki link above. I'm not going to cover them here because for the most part they aren't used. For general theme creation we only really care about the five main output functions discussed here. They will allow you to create a theme that can be edited via gpEasy's edit layouts feature, which then allows the user to organize the layout however they want.

That's it! Five PHP functions you need to make a gpEasy theme. I told you it would be easy.

True WYSIWYG Editing

gpEasy 2.0 introduced true inline WYSIWYG editing. It's very easy to make your theme take advantage of this new feature. To learn how just go to the gpEasy documentation page here.

 

gpEasy B2sq Theme by CS @True Acupuncture