I am making custom shop module for my website and my script breakes all pages where it is. The command what breaks it is: $session =& JFactory::getSession();
(Code putted in default.php). I cant put this in helper as i update the value and i need the updated one. So what i mean with breaks, the template gets broken and leaves the module only. Thank you.
EDIT: The code
$session =& JFactory::getSession();
if($_GET['additem'] != ""){
for($i = 0; $i < count($items); $i++){
if($items[$i][0] == $_GET['additem']){
$id = $i;
}
}
$cart = $session->get('cart', array());
$cart[count($cart)] = $id;
$session->set('cart', $cart);
}else{
$cart = $session->get('cart', array());
}
echo "<table class='table table-hover'>";
echo '<tr>';
echo '<th>Id</th>';
echo '<th>Name</th>';
echo '<th>Price</th>';
echo '</tr>';
for($i = 0; count($cart); $i++){
echo '<tr>';
echo '<td>' . $items[$cart[$i]][0] . '</td>';
echo '<td>' . $items[$cart[$i]][1] . '</td>';
echo '<td>' . $items[$cart[$i]][2] . '</td>';
echo '</tr>';
}
echo '</table>';
JFactory::getSession()
only gets the session object so I doubt this is breaking your site unless you've edited Joomla's core session API file. Could you possibly add a little more code to your question as it will most likely be something else causing your page break$session = JFactory::getSession(); var_dump($session); exit;
.... do you get any data returned?