kartik\helpers\Html::address PHP Method

address() public static method

Example: ~~~ echo Html::address( 'Twitter, Inc.', ['795 Folsom Ave, Suite 600', 'San Francisco, CA 94107'], ['Res' => '(123) 456-7890', 'Off'=> '(456) 789-0123'], ['Res' => '[email protected]', 'Off' => '[email protected]'] ); $address = Html::address( 'Twitter, Inc.', ['795 Folsom Ave, Suite 600', 'San Francisco, CA 94107'], ['Res' => '(123) 456-7890', 'Off'=> '(456) 789-0123'], ['Res' => '[email protected]', 'Off' => '[email protected]'], Html::icon('phone'), Html::icon('envelope') ); echo Html::well($address, Html::SIZE_TINY); ~~~
See also: http://getbootstrap.com/css/#type-addresses
public static address ( string $name, array $lines = [], array $phone = [], array $email = [], array $options = [], string $phoneLabel = '(P)', string $emailLabel = '(E)' ) : string
$name string the addressee name.
$lines array the lines of address information.
$phone array the list of phone numbers - passed as $key => $value, where: - `$key`: _string_, is the phone type could be 'Res', 'Off', 'Cell', 'Fax'. - `$value`: _string_, is the phone number.
$email array the list of email addresses - passed as $key => $value, where: - `$key`: _string_, is the email type could be 'Res', 'Off'. - `$value`: _string_, is the email address.
$options array html options for the address.
$phoneLabel string the prefix label for each phone - defaults to '(P)'.
$emailLabel string the prefix label for each email - defaults to '(E)'.
return string
    public static function address($name, $lines = [], $phone = [], $email = [], $options = [], $phoneLabel = '(P)', $emailLabel = '(E)')
    {
        Enum::initI18N();
        $addresses = '';
        if (!Enum::isEmpty($lines)) {
            $addresses = implode('<br>', $lines) . "<br>\n";
        }
        $phones = '';
        foreach ($phone as $type => $number) {
            if (is_numeric($type)) {
                // no keys were passed to the phone array
                $type = static::tag('abbr', $phoneLabel, ['title' => Yii::t('kvenum', 'Phone')]) . ': ';
            } else {
                $type = static::tag('abbr', $phoneLabel . ' ' . $type, ['title' => Yii::t('kvenum', 'Phone')]) . ': ';
            }
            $phones .= "{$type}{$number}<br>\n";
        }
        $emails = '';
        foreach ($email as $type => $addr) {
            if (is_numeric($type)) {
                // no keys were passed to the email array
                $type = Html::tag('abbr', $emailLabel, ['title' => Yii::t('kvenum', 'Email')]) . ': ';
            } else {
                $type = Html::tag('abbr', $emailLabel . ' ' . $type, ['title' => Yii::t('kvenum', 'Email')]) . ': ';
            }
            $emails .= $type . static::mailto($addr, $addr) . "<br>\n";
        }
        return static::tag('address', "<strong>{$name}</strong><br>\n" . $addresses . $phones . $emails, $options);
    }

Usage Example

Beispiel #1
0
<?php

/* @var $this yii\web\View */
use kartik\helpers\Html;
$this->title = 'contact-ubudsatu.com';
?>


<div class="content">
			<div class="content">					
				
				 <div class="row">
					<div class="col-md-12">
						<h4 class="page-head-line">CONTACT</h4>			
						<?php 
echo Html::well(Html::address('DUTA BINTARO, Cluster Ubud Satu', ['Kelurahan Kunciran, Kecamatan Pinang', 'Tangerang.'], ['Tel ' => '(021) '], ['Fax ' => '(021) '], ['Website : ' => 'www.ubudsatu.com', 'Email' => '*****@*****.**']), Html::SIZE_TINY);
?>
		
				</div>
				 	
			</div>				
		</div>
</div>
All Usage Examples Of kartik\helpers\Html::address