Xoops Blocks

 

Blocks Overview

Blocks are used for navigation menus or content, and can be placed on the left; right; center-center; center-left; or center-right of a page. Xoops has an exceptionally powerful and flexible block positioning system. Blocks can be made to appear, or not appear in individual modules or pages. Many Xoops modules normally come with their own blocks already included. These blocks are found in the System Admin-->Blocks section of your Xoops administration..

Most content modules will provide automatic links to the content created through these navigation menus in the blocks. For example, normally the "title" of an article is used as the navigation link to the article's page.

Blocks are often used to provide HTML content, banners or images. Webmasters can easily create their own customized blocks in Xoops using the "Custom Block" tool.

To find the Blocks admin go to got to your site admin, and let your mouse hover over the System Admin icon, then choose Blocks. This where you set up visibility and positioning of blocks that appear in Xoops.

Note: Anonymous Users will not be able to access the blocks unless you add permissions in System Admin-->Groups-->Anonymous Users

In blocks admin you will see a screen similar to the screen below.


How do I setup a block included with a Module?

To find the Blocks admin go to got to your site admin, and let your mouse hover over the System Admin icon--then choose Blocks. The screen below is a cut-down version for illustration purposes.

Title

Module

Side
Left-Center-Right

Weight

Visible

Action

Main Menu

System

--

Yes No

Edit

News Topics

News

--

Yes No

Edit

Big Story

News

--

Yes No

Edit

Top News

News

--

Yes No

Edit

Recent News

News

--

Yes No

Edit

Recent Topics

Forum

--

Yes No

Edit

Most Active Topics

Forum

--

Yes No

Edit

Notice the Recent Topics block above marked in yellow. I have set the block to be visible on the center-center of the Xoops page. See the check mark in the Side Left-Center-Right column. I have also set the "Visible" column for Recent Topics to Yes

These radio buttons mean the following reading left to right:

First = Extreme Left Column

Second = Center-Left of page

Third = Center-Center of page

Fourth  = Center-Right of page

Fifth = Extreme Right column

Although visibility settings are set to Yes, anonymous users will not be able to see this block.

Notice when you come into the Xoops blocks administration that the initial default is only to show the blocks that are visible or not visible to registered users. See the top of the initial Blocks Administration page. Admin can choose other views, for example you can select to see the blocks that have visibility settings for Anonymous Users.

Show blocks visible in  Group Visible

To allow anonymous users to access the block you must now add block permissions:

Go to System Admin-->Groups-->Anonymous Users. Also see the Groups section for more on groups and permissions.


How do I make a block appear in multiple modules?

To find the Blocks admin go to got to your site admin, and let your mouse hover over the System Admin icon--then choose Blocks. Notice the Block located Here has an "Action" column to the extreme right with an "Edit" command included. Click Edit to the right of the block concerned, which will bring up a screen like the following:

Notice the "Visible in" section. If Top page is selected then the block will appear in the default launch page only. If All pages is selected then the block will appear in every module. To have the block only appear in selected modules make sure All pages is deselected, and select only the modules you wish the block to appear in. You can hold down the Ctrl or Shift keys on your keyboard for multiple selection. Remember to set the Visibility field to Yes.

Note: This only sets up the visibility settings, permissions still need to be added. Anonymous Users for example will not be able to access the blocks unless you add permissions in System Admin-->Groups-->Anonymous Users.


How do I change the Title of a block?

To find the Blocks admin go to got to your site admin, and let your mouse hover over the System Admin icon--then choose Blocks. Then find the block you wish to change the title of, and look for the Edit command to the extreme right of the block

Then look for the Title field, and edit the Title to your preferences and click Submit..

Title

Editing a block's layout:

A Blocks layout for existing modules is normally controlled from the Xoops Templates. To edit a block go to System-->Admin-->Blocks and look for the block you wish to alter then click "Edit" to the right of the block. In the next dialogue box you should see "Edit Template". Click this, and you will see the code for your block. You will also see the "classes" that are being called which relate to the style.css sheet(s) in your themes folder.

If you are using the Default Template you will need to Clone this first as you cannot edit the Default Template. To learn more about Templates click Here


How do I setup a custom block?

To create a custom block go to System-->Admin-->Blocks. At the bottom section of the screen you will see the custom block tool which looks like this:

Next set the visibility settings and add a title for the block in the Title field. Now add any HTML coding into the Xoops editor. If adding HTML code, leave the default "Content Type" at HTML and then submit.

PHP code can be added to custom blocks, but do not include the PHP tags if doing so. Remember to save the block in PHP format.

A list of available formats are available below.

Content Type

Cache lifetime

Note: Permissions still need to be added. Anonymous Users for example will not be able to access the blocks unless you add permissions in System Admin-->Groups-->Anonymous Users.

 

 

 

 

jackj macambridge.com