Documentation

IncludeString

string
CMain::IncludeString(
 string text,
 array icons = array()
)

The method takes a string and returns the HTML code of the specified text bordered in the frame decorated with the specified buttons. Non-static method.

Parameters

ParameterDescription
text Text to insert in the frame (HTML code).
icons Array of button descriptors. Each descriptor is an array with the following keys:
  • URL - the link to open upon click;
  • SRC - path to the button image;
  • ALT - tooltip text.

See Also

Examples of use

<?
$text = "Some HTML";

// if the button "Show included areas" is checked
if ($APPLICATION->GetShowIncludeAreas())
{
    $arIcons = Array();
    $arIcons[] =
            Array(
                "URL" => "/bitrix/admin/my_script1.php",
                "SRC" => "/images/my_icon1.gif",
                "ALT" => "tooltip text"
            );
    $arIcons[] =
            Array(
                "URL" => "/bitrix/admin/my_script2.php",
                "SRC" => "/images/my_icon2.gif",
                "ALT" => "tooltip text"
            );

    // display text "Some HTML" in the frame,
    // with buttons my_icon1.gif and my_icon2.gif
    // linked to scripts my_script1.php and my_script2.php

    echo $APPLICATION->IncludeString($text, $arIcons);
}
else 
{
    // otherwise display "Some HTML"
    echo $text;
}
?>
<?
// file /bitrix/modules/advertising/classes/general/advertising.php 
// CAdvBanner

// returns HTML of a banner by its type
function Show($TYPE_SID, $HTML_BEFORE="", $HTML_AFTER="")
{
    global $APPLICATION, $USER;
    $arBanner = CAdvBanner::GetRandom($TYPE_SID);
    $strReturn = CAdvBanner::GetHTML($arBanner);
    if (strlen($strReturn)>0)
    {
        CAdvBanner::FixShow($arBanner);
        if ($APPLICATION->GetShowIncludeAreas())
        {
            $isDemo = CAdvContract::IsDemo();
            $arrPERM = CAdvContract::GetUserPermissions($arBanner["CONTRACT_ID"]);
            if (($isDemo || (is_array($arrPERM) && count($arrPERM)>0)) && $USER->IsAuthorized())
            {
                $arIcons = Array();
                $arIcons[] =
                        Array(
                            "URL" => "/bitrix/admin/adv_banner_edit.php?lang=".LANGUAGE_ID."&ID=".$arBanner["ID"]. "&CONTRACT_ID=".$arBanner["CONTRACT_ID"],
                            "SRC" => "/bitrix/images/advertising/panel/edit_ad.gif",
                            "ALT" => GetMessage("AD_PUBLIC_ICON_EDIT_BANNER")
                        );
                $arIcons[] =
                        Array(
                            "URL" => "/bitrix/admin/adv_banner_list.php?lang=".LANGUAGE_ID."&find_id=".$arBanner["ID"]. "&find_id_exact_match=Y&find_contract_id[]=".$arBanner["CONTRACT_ID"]. "&find_type_sid[]=".$arBanner["TYPE_SID"]."&set_filter=Y",
                            "SRC" => "/bitrix/images/advertising/panel/edit_ad_list.gif",
                            "ALT" => GetMessage("AD_PUBLIC_ICON_BANNER_LIST")
                        );
                $strReturn = $APPLICATION->IncludeString($strReturn, $arIcons);
            }
        }
        $strReturn = $HTML_BEFORE.$strReturn.$HTML_AFTER;
        return $strReturn;
    }
    else return false;
}
?>


© «Bitrix24», 2001-2022
Up