/ LJCPHPCodeDoc / LJCTextBuilderLib / LJCTextBuilder / GetBegin


Parameters
$name - The element name.
$textState - The current text state values.
$htmlAttribs - The element attributes.
$addIndent - _ParamSummary_
$childIndent - _ParamSummary_

Returns

The HTML element begin tag.

Syntax

PHP
public function GetBegin(string $name, LJCTextState $textState
, LJCAttributes $attribs = null, bool $addIndent = true
, bool $childIndent = true): string

Gets the element begin tag.

Remarks

GetBegin() is an "Get Text" method which creates the element opening tag with GetCreate() and returns the text value.
Note: One should set the "addIndent" parameter to false when adding text to the builder after getting the text with a "GetText" method. This is because the the indent has already been added with the "GetText" method.

Example

PHP
 $textState = new LJCTextState();
 $tb = new LJCTextBuilder();
 
 // Example Method:
 // Starts the text with a newline if the builder already has text, param
 // allowNewLine = true and builder text does not end with a newline.
 // The text begins with the current indent string if param
 // addIndent = true.
 // Defaults: addIndent = true, allowNewLine = true.
 $result = $tb->GetBegin("body", $textState);
 
 // result:
 // <body>

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.