"die();" doesnt work on my custom widget - rightnow-crm

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();

Related

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

Show variable outside while loop

Hy. I know there are answers similar, but i can't get it going. Here is my cod:
<?php include 'header.php'; ?>
<?php include 'connect.php';
$q = mysqli_query($link, $aaa = 'SELECT * FROM agentii LEFT JOIN orase ON agentii.oras=orase.oras_id WHERE orase.oras_id = \'' .$_GET['id']. '\'') or die(mysqli_error($link));
$row = mysqli_fetch_assoc($q);
?>
<h2>Title <em><?php echo $row['oras'];?></em></h2>
<div class="div_view">
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr>
<th>Agentie</th>
<th>Adresa</th>
</tr>
<?php while ($row = mysqli_fetch_assoc($q)) { ?>
<tr>
<td><?php echo $row['agentie'];?></td>
<td><?php echo $row['adresa'];?></td>
</tr>
<?php }?>
</table>
</div>
<?php include 'footer.php'; ?>
This output(i can't put images because is a new account - so i put a link to a prt src):
http://postimage.org/image/w9zsexz91/
In my database i have 3 rows, and the code outputs only 2.
I know that is because of the 2 mysqli_fetch_assoc, but i want to show all the rows, and i want to show the title too (<?php echo $row['oras'];?>) outside the while.
Can someone please help me with this?
Thx in advance!
obligatory warning first: Remember little Bobby Tables!
(or: your code is vulnerable to sql injection attacks)
then: you get only two rows in the while loop, because you requested a row outside the loop first, thus increasing the internal cursor in the result.
If you want to get title and rows in one go, you need to cache the result, for example:
$resultArray = array();
while ($row = mysqli_fetch_assoc($q)) {
$resultArray[] = $row;
}
//....
?>
<h2><?php echo $resultArray[0]['oras']; ?></h2>
<?php // ... ?>
<?php foreach($resultArray as $row) {
<tr>
<td><?php echo $row['agentie'];?></td>
<td><?php echo $row['adresa'];?></td>
</tr>
} ?>
this is just a stub, of course you should implement checks if you got a row at all etc...
Try:
<?php do { ?>
<tr>
<td><?php echo $row['agentie'];?></td>
<td><?php echo $row['adresa'];?></td>
</tr>
<?php } while ($row = mysqli_fetch_assoc($q)); ?>
The first iteration of this loop will print the first fetched row. I have only changed the location of the while clause, forcing the code of the loop to be run before a new row is fetched.