<div id="cart" class="btn-group btn-block">
<button type="button" data-toggle="dropdown" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-inverse btn-block btn-lg dropdown-toggle"><i class="fa fa-shopping-cart"></i> <span id="cart-total"><?php echo $text_items; ?></span></button>
<ul class="dropdown-menu pull-right">
<?php if ($products || $vouchers) { ?>
<li>
<table class="table table-striped">
<?php foreach ($products as $product) { ?>
<tr>
<td class="text-center"><?php if ($product['thumb']) { ?>
<a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-thumbnail" /></a>
<?php } ?></td>
<td class="text-left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
<?php if ($product['option']) { ?>
<?php foreach ($product['option'] as $option) { ?>
<br />
- <small><?php echo $option['name']; ?> <?php echo $option['value']; ?></small>
<?php } ?>
<?php } ?>
<?php if ($product['recurring']) { ?>
<br />
- <small><?php echo $text_recurring; ?> <?php echo $product['recurring']; ?></small>
<?php } ?></td>
<td class="text-right">x <?php echo $product['quantity']; ?></td>
<td class="text-right"><?php echo $product['total']; ?></td>
<td class="text-center"><button type="button" onclick="cart.remove('<?php echo $product['cart_id']; ?>');" title="<?php echo $button_remove; ?>" class="btn btn-danger btn-xs"><i class="fa fa-times"></i></button></td>
</tr>
<?php } ?>
<?php foreach ($vouchers as $voucher) { ?>
<tr>
<td class="text-center"></td>
<td class="text-left"><?php echo $voucher['description']; ?></td>
<td class="text-right">x 1</td>
<td class="text-right"><?php echo $voucher['amount']; ?></td>
<td class="text-center text-danger"><button type="button" onclick="voucher.remove('<?php echo $voucher['key']; ?>');" title="<?php echo $button_remove; ?>" class="btn btn-danger btn-xs"><i class="fa fa-times"></i></button></td>
</tr>
<?php } ?>
</table>
</li>
<li>
<div>
<table class="table table-bordered">
<?php foreach ($totals as $total) { ?>
<tr>
<td class="text-right"><strong><?php echo $total['title']; ?></strong></td>
<td class="text-right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</table>
<p class="text-right"><a href="<?php echo $cart; ?>"><strong><i class="fa fa-shopping-cart"></i> <?php echo $text_cart; ?></strong></a> <a href="<?php echo $checkout; ?>"><strong><i class="fa fa-share"></i> <?php echo $text_checkout; ?></strong></a></p>
</div>
</li>
<?php } else { ?>
<li>
<p class="text-center"><?php echo $text_empty; ?></p>
</li>
<?php } ?>
</ul>
</div>
class Mailer {
public $from;
public $to;
public $subject;
public $message;
public function setFrom(){
$this->from = 'my@mail.ru';
return $this;
}
public function setTo(){
$this->to = 'you@mail.ru';
return $this;
}
public function setSub(){
$this->subject = 'Hello!';
return $this;
}
public function setMess(){
$this->message = 'Good morning friend.';
return;
}
}
$x = new Mailer();
$x->setFrom()->setTo()->setSub()->setMess();
// Смотрим что получилось:
echo $x->from . "<br>";
echo $x->to . "<br>";
echo $x->subject . "<br>";
echo $x->message . "<br>";
<?php
$mainCat = array(
0=>array("id"=>"1", "parent"=>"", "name"=>"Первая категория"),
1=>array("id"=>"2", "parent"=>"", "name"=>"Вторая категория")
);
$subCat = array(
0=>["id"=>"3", "parent"=>"2", "name"=>"Подкатегория первая"],
1=>["id"=>"4", "parent"=>"2", "name"=>"Подкатегория вторая"]
);
echo "<pre>";
print_r($mainCat);
echo "</pre>";
echo "<pre>";
print_r($subCat);
echo "</pre>";
function searchForId($id, $array) {
foreach ($array as $val) {
if ($val['parent'] === $id) {
$a[] = $val['id'];
}
}
return $a;
}
$id = searchForId('2', $subCat);
echo 'У категории найдены следующие подкатегории: '; print_r($id);
?>
<script src='https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js' referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '#mytextarea'
});
</script>
<form method="post">
<textarea id="mytextarea" name="mytextarea">Hello, World!</textarea>
</form>