The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
Zotlabs\Render\Comanche Class Reference

Comanche Page Description Language. More...

Public Member Functions

 parse ($s, $pass=0)
 
 parse_pass0 ($s)
 
 parse_pass1 ($s)
 
 get_condition_var ($v)
 Replace conditional variables with real values. More...
 
 test_condition ($s)
 Test for Conditional Execution conditions. More...
 
 menu ($s, $class= '')
 Return rendered menu for current channel_id. More...
 
 replace_region ($match)
 
 get_channel_id ()
 Returns the channel_id of the profile owner of the page. More...
 
 block ($s, $class= '')
 Returns a parsed block. More...
 
 js ($s)
 Include JS depending on framework. More...
 
 css ($s)
 Include CSS depending on framework. More...
 
 webpage (&$a, $s)
 
 widget ($name, $text)
 Render a widget. More...
 
 region ($s, $region_name)
 
 register_page_template ($arr)
 Registers a page template/variant for use by Comanche selectors. More...
 

Detailed Description

Comanche Page Description Language.

Comanche is a markup language similar to bbcode with which to create elaborate and complex web pages by assembling them from a series of components - some of which are pre-built and others which can be defined on the fly. Comanche uses a Page Decription Language to create these pages.

Comanche primarily chooses what content will appear in various regions of the page. The various regions have names and these names can change depending on what layout template you choose.

Member Function Documentation

Zotlabs\Render\Comanche::block (   $s,
  $class = '' 
)

Returns a parsed block.

Parameters
string$s
string$class(optional) default empty
Returns
string parsed HTML of block

Referenced by Zotlabs\Render\Comanche\region().

Zotlabs\Render\Comanche::css (   $s)

Include CSS depending on framework.

Parameters
string$s
Returns
string

Referenced by Zotlabs\Render\Comanche\region().

Zotlabs\Render\Comanche::get_channel_id ( )

Returns the channel_id of the profile owner of the page.

Returns the channel_id of the profile owner of the page, or the local_channel if there is no profile owner. Otherwise returns 0.

Returns
int channel_id

Referenced by Zotlabs\Render\Comanche\block(), and Zotlabs\Render\Comanche\menu().

Zotlabs\Render\Comanche::get_condition_var (   $v)

Replace conditional variables with real values.

Currently supported condition variables:

  • $config.xxx.yyy - get_config with cat = xxx and k = yyy
  • $request - request uri for this page
  • $observer.language - viewer's preferred language (closest match)
  • $observer.address - xchan_addr or false
  • $observer.name - xchan_name or false
  • $observer - xchan_hash of observer or empty string
  • $local_channel - logged in channel_id or false
Parameters
string$vThe conditional variable name
Returns
string|boolean

Referenced by Zotlabs\Render\Comanche\parse(), and Zotlabs\Render\Comanche\test_condition().

Zotlabs\Render\Comanche::js (   $s)

Include JS depending on framework.

Parameters
string$s
Returns
string

Referenced by Zotlabs\Render\Comanche\region().

Zotlabs\Render\Comanche::menu (   $s,
  $class = '' 
)

Return rendered menu for current channel_id.

See Also
menu_render()
Parameters
string$s
string$class(optional) default empty
Returns
string

Referenced by Zotlabs\Render\Comanche\block(), and Zotlabs\Render\Comanche\region().

Zotlabs\Render\Comanche::parse (   $s,
  $pass = 0 
)
Zotlabs\Render\Comanche::parse_pass0 (   $s)
Zotlabs\Render\Comanche::parse_pass1 (   $s)
Zotlabs\Render\Comanche::region (   $s,
  $region_name 
)
Zotlabs\Render\Comanche::register_page_template (   $arr)

Registers a page template/variant for use by Comanche selectors.

Parameters
array$arr'template' => template name 'variant' => array( 'name' => variant name 'desc' => text description 'regions' => array( 'name' => name 'desc' => text description ) )
Zotlabs\Render\Comanche::replace_region (   $match)
Zotlabs\Render\Comanche::test_condition (   $s)

Test for Conditional Execution conditions.

This is extensible. The first version of variable testing supports tests of the forms:

  • [if $config.system.foo ~= baz] which will check if get_config('system','foo') contains the string 'baz';
  • [if $config.system.foo == baz] which will check if get_config('system','foo') is the string 'baz';
  • [if $config.system.foo != baz] which will check if get_config('system','foo') is not the string 'baz';
  • [if $config.system.foo >= 3] which will check if get_config('system','foo') is greater than or equal to 3;
  • [if $config.system.foo > 3] which will check if get_config('system','foo') is greater than 3;
  • [if $config.system.foo <= 3] which will check if get_config('system','foo') is less than or equal to 3;
  • [if $config.system.foo < 3] which will check if get_config('system','foo') is less than 3;
  • [if $config.system.foo {} baz] which will check if 'baz' is an array element in get_config('system','foo')
  • [if $config.system.foo {*} baz] which will check if 'baz' is an array key in get_config('system','foo')
  • [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo');

The values 0, '', an empty array, and an unset value will all evaluate to false.

Parameters
int | string$s
Returns
boolean

Referenced by Zotlabs\Render\Comanche\parse().

Zotlabs\Render\Comanche::webpage ( $a,
  $s 
)

This doesn't really belong in Comanche, but it could also be argued that it is the perfect place. We need to be able to select what kind of template and decoration to use for the webpage at the heart of our content. For now we'll allow an '[authored]' element which defaults to name and date, or 'none' to remove these, and perhaps 'full' to provide a social network style profile photo.

But leave it open to have richer templating options and perhaps ultimately discard this one, once we have a better idea of what template and webpage options we might desire.

Parameters
[in,out]array$a
string$s
Returns
array

Referenced by Zotlabs\Render\Comanche\parse_pass0().

Zotlabs\Render\Comanche::widget (   $name,
  $text 
)

Render a widget.

Parameters
string$name
string$text

Referenced by Zotlabs\Render\Comanche\region().


The documentation for this class was generated from the following file: