can anyone explain me why is my function value shown on a page immediately even without putting <?php echo $mobile; ?>
I just type this part:
<?php $mobile = table_phone(); ?>
and phone number gets displayed, but not where I want it. Not where I call
<?php echo $mobile; ?>
I tried to use other function like osc_user_phone_land()
which is part of the osclass core and that one is working fine, but calling for mobile_phone, which is actually part of the plugin is not working properly.
Any ideas? My coding knowledge is quite limited so it might be a super simple fix..
Here is the more of the code:
<div class="description-right">
<?php
$mobile = '';
if($mobile == '') { $mobile = table_phone(); }
if($mobile == '') { $mobile = __('No phone number', 'OSCLASS'); }
?>
<div class="mob-wrap">
<div class="mob-top">
<span><i class="fa fa-phone"></i><?php _e("Contact", 'OSCLASS'); ?> </span>
</div>
<div class="mobile-show" rel="<?php echo $mobile; ?>">
<span>
<?php
if(strlen($mobile) > 3 and $mobile <> __('No phone number', 'OSCLASS')) {
echo substr($mobile, 0, strlen($mobile) - 3) . 'XXX';
} else {
echo $mobile;
}
?>
</span>
</div>
</div>
function from helper.php
<?php
function get_realestate_attributes(){
$locale = osc_current_user_locale();
$return = array('attributes','other_attributes','special','lang','tel_num');
$detail = ModelRealEstate::newInstance()->getAttributes( osc_item_id() );
$keys = array_keys($detail) ;
if(count($keys) == 1 && $keys[0] == 'locale' && is_null($detail[0]['locale']) ){
// nothing to do
return false;
}
if(@@$detail['locale'][$locale]['s_number'] != "") {
$return['tel_num']['year'] = array(
'label' =>__('Telephone number', 'realestate_attributes')
,'value' => @@$detail['locale'][$locale]['s_number']
);
}
return $return;
}
function table_phone(){
$detail = get_realestate_attributes();
if($detail['tel_num']){
?>
<span>
<?php
foreach($detail['tel_num'] as $item){
echo ''.$item['value'].'';
}
?>
</span>
<?php
}
}