convert millisecond to DateTime in HTML page YII - yii

how to convert millisecond to datetime in yii?
*ps : in this code my Date_In in millisecond
here is my code:
<b><?php echo CHtml::encode($data->getAttributeLabel('Date_In')); ?>:</b>
<?php echo CHtml::encode($data->Date_In); ?>
<br />

You can use formatDateTime function of yii;
<?php echo Yii::app()->dateFormatter->formatDateTime($data->Date_In, 'long', false); ?>
Or simply date() function of PHP
<?php echo date('d.m.Y', $data->Date_In); ?>

Related

"die();" doesnt work on my custom widget

I'm working on Oracle Rightnow and i have to create a custom widget. I want to try with a die(); on him but it never dies. How can I interrupt the widget to see a variable value?
<? $reportColumns = count($this->data['reportData']['headers']);
foreach ($this->data['reportData']['data'] as $value):
die(var_dump($value));?>
<rn:block id="resultListItem">
<li>
<? for ($i = 0; $i < $reportColumns; $i++): ?>
<? $header = $this->data['reportData']['headers'][$i]; ?>
<? if ($this->showColumn($value[$i], $header)):
if ($i < 3):
if ($i === 0): ?>
<div class="rn_Element<?=$i + 1?>"><h3><?=$value[$i];?></h3></div>
<? else: ?>
<span class="rn_Element<?=$i + 1?>"><?=$value[$i];?></span>
<? endif; ?>
<? else: ?>
<span class="rn_ElementsHeader"><?=$this->getHeader($header);?></span>
<span class="rn_ElementsData"><?=$value[$i];?></span>
<? endif; ?>
<? endif; ?>
<? endfor; ?>
</li>
</rn:block>
<? endforeach; ?>
Are you sure that die isn't working? If you view source, is the HTML broken where you at the point where you called exit? If you exit from your view, then HTML would still be returned to the browser and rendered from elements that were created prior to the widget's construction.
You may try exit instead of die, but I think you'll get the same result.
However, the easier way to print the values of your array would be to do it from your widget's controller and exit the process there.
echo "<pre>",print_r($this->data['reportData']),"</pre>";
exit();

How To add Two Variables To An Ahref

i have two variables
one is $wallet
the second is
$link
i liked to make something like that:
<div>hi' <?php echo $userRow['user_wallet']; ?> Check Your Bitcoins </div>
How Can I Do This?
i finally i tank so i discover how to do..
$user_points = $row['user_points'];
$wallet = $row['user_wallet'];
$link = "https://faucetbox.com/check/";;
$resultlink = $link.$wallet;
<a href="<?php echo "$link"; ?><?php echo $userRow['user_wallet']; ?>" >Check Your Adress</a>

Bootstrap calendar option

I use a calendar to select dates for two types of inscription
for the first one all days are enabled for the second only sunday are enabled
if the code is like that how can i use the right one
if ($type==12){ daysOfWeekDisabled:[1,2,3,4,5,6],}
please some one help me
this is my code
$('#op_calender_inscription').datepicker({
format: "dd/mm/yyyy",
<?php if($operation->start !='00/00/0000'): ?>
startDate: '<?php echo $operation->start ?>',
if ($type == 12)
{daysOfWeekDisabled:[1,2,3,4,5,6],}
<?php
endif;
if($operation->end !='00/00/0000'): ?>
endDate: '<?php echo $operation->end ?>',
<?php endif; ?>
multidate: true,
multidateSeparator:";",
calendarWeeks: true,
language: 'fr'
You are using it with PHP right? then:
<?php if ($type == 12) : ?>
{daysOfWeekDisabled:[1,2,3,4,5,6],}
<?php endif; ?>

Making new variable for drupal 7 theme showing error notice

Hi I am trying to make a new variable for drupal 7 theme. My theme name is ntheme. For this I have defined a function in template.php :
function ntheme_gnu_preprocess(&$variables)
{
$variables['disclaimer'] = t('Comments are unaythorized. The views expressed are those of the comment author.');
}
And used this variable $disclaimer in comment-wrapper.tpl.php:
<div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if ($content['comments'] && $node->type != 'forum'): ?>
<?php print render($title_prefix); ?>
<h2 class="title"><?php print t('Comments'); ?></h2>
<?php print render($title_suffix); ?>
<?php endif; ?>
<?php print render($content['comments']); ?>
<?php if ($content['comment_form']): ?>
<h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
<?php print render($content['comment_form']); ?>
<?php endif; ?>
<p><?php print $disclaimer; ?></p>
</div>
But it showing Notice :
Notice: Undefined variable: disclaimer in include() (line 39 of
C:\wamp\www\drupal\sites\all\themes\ntheme\templates\comment-wrapper.tpl.php).
Whats wrong I am doing ?
Is your theme name ntheme_gnu or ntheme beacuse if ur theme name is ntheme u should call the hook_preprocess as ntheme_preprocess()

virtuemart 2 product pdf does not display custom fields

I'm using VirtueMart 2.0.10 with Joomla! 2.5.6 and my problem is the autogenerated pdf documents for each product don't include my custom fields. I'm no php expert but I think theese lines in file /components/com_virtuemart/views/productdetails/tmpl/default_pdf.php has something to do with it, starting at line 145:
<?php // Product custom_fields TODO relation to Childs
if (!empty($this->product->customfields)) { ?>
<div class="product-fields">
<?php
$custom_title = null ;
foreach ($this->product->customfields as $field){
?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
<?php if ($field->custom_title != $custom_title) { ?>
<span class="product-fields-title" ><strong><?php echo JText::_($field->custom_title); ?></strong></span>
<?php //echo JHTML::tooltip($field->custom_tip, $field->custom_title, 'tooltip.png');
} ?>
<span class="product-field-display"><?php echo $field->display ?></span>
<span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
</div>
<?php
$custom_title = $field->custom_title;
} ?>
</div>
<?php
} // Product custom_fields END ?>
I tested adding an else statement echoing some text after the above if statement and it executetd. So apperently there are no custom fields... but there really are...
I haven't found anyone else experiencing this problem wich I think is weird, but I don't think I have screwed something up. I HAVE made a few changes in the /components/com_virtuemart/views/productdetails/tmpl/default.php file.
I removed all the code that I entered in my question and replaced it with the following code from the file /components/com_virtuemart/views/productdetails/tmpl/default.php:
<?php
$custom_title = null;
foreach ($this->product->customfieldsSorted['normal'] as $field) { // I set the position to normal
if ( $field->is_hidden )
continue;
if ($field->display) {
?>
<?php if ($field->custom_title != $custom_title) { ?>
<b><?php echo JText::_($field->custom_title); ?></b><br />
<?php
if ($field->custom_tip)
echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png');
}
?>
<?php echo $field->display ?><br />
<?php echo jText::_($field->custom_field_desc) ?><br />
<?php
$custom_title = $field->custom_title;
}
}
?>
I'm no expert but this worked for me. The PDF now includes the custom fields.
As you see in the comment in the code I changed the position to 'normal'. The other positions seems to be 'ontop' and 'onbot'. But I won't change that setting so I leave it be.
EDIT: I forgot to mention I added some other html-code to that segment, like <br /> and <b> just for apperences. So nothing major, just to clarify that the code isn't EXACTLY like it is in the file default.php