Loading...
 
Code Snippets for Reuse - Part 2

TRP_Code_Snippets_Part2

TRP Code Snippets - Part 2


These pages brings together short snippets of code which can be used within wiki pages to make a richer experience for our community members.

Please ensure you copy the snippet in its entirety. Some snippets are deliberately "finger printed" with a Tiki comment to make finding them easier in future should the snippet need to be modified as the Tiki software matures from version to version.

Restrict Paragraph Content

To restrict the content of a paragraph to Community Members Only, the following snippet of code can be used.

Restricted Paragraph Snippet
{GROUP(groups=>Registered)}Community Members see this, but anonymous browsers see nothing.{GROUP}
Note that this code shows nothing to anonymous users, so please only use it to protect a part of a Wiki page, never a whole page. It would show a blank page to the anonymous user, which is not good practice. For additional information and guidance plus code snippets for other similar scenarios, please see the FAQ For Our Eyes Only.


Restrict Part of Wiki Page Content

This technique can be extended to show only the initial part of a page to anonymous users, in the hope of tempting them to register, whilst showing the whole page to community members.
Restrict Part of Page Snippet
Public content, visible to anonymous users and Community Members, goes here. Perhaps ending part way {GROUP(groups=>Registered)}through a paragraph. The remainder of the Page content for Community Members goes here.{ELSE}~hs~...~hs~...%%%~hs~%%%The remainder of this page is only available to community members. Why not ((TRP_Join_Us|join us))?{GROUP}
This snippet isn't very easy to understand at first glance, but adding some newlines (which should NOT occur in the production code) helps to improve readability.

Pseudo Code - formatted for readability - Do not copy this
Public content, visible to anonymous users and Community Members, goes here. Perhaps ending part way 

{GROUP(groups=>Registered)}through a paragraph. The remainder of the Page content for Community Members goes here.



{ELSE}~hs~...~hs~...%%%
~hs~%%%
The remainder of this page is only available to community members. Why not ((TRP_Join_Us|join us))?
{GROUP}

The result is that anonymous users see

Public content, visible to anonymous users and Community Members, goes here. Perhaps ending part way  ... ...
 
The remainder of this page is only available to community members. Why not join us
whilst Community members see

Public content, visible to anonymous users and Community Members, goes here. Perhaps ending part way through a paragraph. The remainder of the Page content for Community Members goes here.
For additional information and guidance plus code snippets for other similar scenarios, please see the FAQ For Our Eyes Only.


Restrict Whole Wiki Page Content

To restrict the whole of a wiki page to Community Members Only, the following snippet of code can be used.
Restrict Whole Page Snippet
{GROUP(groups=>Registered)}Page content for Community Members goes here.

{ELSE}This content is only available to community members. Why not ((TRP_Join_Us|join us))?{GROUP}
For additional information and guidance plus code snippets for other similar scenarios, please see the FAQ For Our Eyes Only.
Contributors to this page: @TRP-GC and MartinB. .
Page last modified on Thursday 08 of March, 2018 09:13:48 CST by @TRP-GC.