Menu Blocks and Items

From PhpCOIN Documentation

Jump to: navigation, search

Contents

Sidebox Menus

phpCOIN can display one or more menu blocks in either or both of the left and right-hand columns. Each menu block can contain hyperlinks or images or even the output from a php function.

Menu Blocks

A Menu Block is the "wrapper" that holds one or more menu 'items':

Image:menu_block.png

  • Position: The display order of the block
  • Title: The header for the block
  • Status: ON is viewable, OFF is not displayed
  • Admin Block: YES means that only an admin can see the block
  • User Block: YES means that only a logged in user or admin can see the block
  • Column: Whether this block should appear in the left-column or the right-column or neither column on pages that have the appropriate column turned ON in Admin -> Components


Menu Items

A Menu Item is part of the actual content for a Menu Block. A Menu Block will have one or more Menu Items:

Image:menu_block_item.png

  • Block ID: Which Menu Block this item is assigned to.
  • Item ID: The order to display the item in within the block
  • Text: The content for the item ~ what the user sees
  • URL: Where to link to, if it is a linkable item
  • Target: Whether the link should open in a new window, the same window, etc.
  • Type: Whether this is a text hyperlink, an image, or the output from a php function
  • Status: ON means the item is visible, OFF is not displayed
  • Admin Item: YES means that only an admin can see the item
  • User Item: YES means that only a logged in user or admin can see the item


Menu Item Types

A menu item can be text or an image or the output from a php function.


Text Hyperlink

Enter the text for the link in the Text field and the hyperlink URL in the URL field. Set the "Type" to Text


Image

First define the image in the /coin_themes/theme/config.php file. Simply copy one of the existing image definitions, and edit as required. For the Menu Item enter the variable name for the image in the Text field. The variable name 'must' begin with "$" and no single quotes in the variable ~ for example: $_TCFG[_IMG_RATE_PHPCOIN_B]

Enter the URL that the image will redirect to when clicked in the URL field, and set the "Type" to Image.


php Function

First add the function in your copy of the <phpdir>/coin_includes/custom.php file or even better, in <phpdir>/coin_includes/custom_overrides.php

Some restrictions on the function:

  • The function must return code and not echo it in the function. If you echo it, you will end up with the output at the wrong place on the screen.
  • The function name MUST begin with "do_" for security reasons.
  • Remember where the output is going. Use something too wide, or that outputs pages of info, and the menu block will reflect this.

Put the name of the function, minus the "do" prefix, in the Text field. This input must begin with the leading underscore "_" and must match the function name except for the leading "do". For example, the custom function is called do_google_adsense in custom.php and the Text is entered as _google_adsense

Enter n/a in the URL field because it is ignored, and set the "Type" to Function

RackSpace Hosting

Personal tools