losing session data - Joomla! Forum - community, help and support


i have created simple plugin changed {wishlist} button stores session of current article title. have module displays sessions shopping cart.

i got 2 problems, first problem (which important) module displays session when navigate different page, example frontpage user-login. lose data session , module becomes empty.

how can store data losing when user closes web browser? code pasted below:

code: select all

<?php

//no direct access

defined('_jexec') or die('restricted access');

//create session
session_start();

$product = mysql_real_escape_string($_post['product']);
$session = jsession::getinstance('product',array($product));
$session->set('product', $product);

echo "<h2>". $session->get('product') ."</h2>";


and lastly how can make session array display more 1 item? it:

code: select all

$session = jsession::getinstance('product',array($product));

thanks in advanced

aaron harding wrote:i have created simple plugin changed {wishlist} button stores session of current article title. have module displays sessions shopping cart.

i got 2 problems, first problem (which important) module displays session when navigate different page, example frontpage user-login. lose data session , module becomes empty.

how can store data losing when user closes web browser? code pasted below:

code: select all

<?php

//no direct access

defined('_jexec') or die('restricted access');

//create session
session_start();

$product = mysql_real_escape_string($_post['product']);
$session = jsession::getinstance('product',array($product));
$session->set('product', $product);

echo "<h2>". $session->get('product') ."</h2>";


and lastly how can make session array display more 1 item? it:

code: select all

$session = jsession::getinstance('product',array($product));

thanks in advanced

calling session_start messing joomla's session handling.

probably easier do:
$app = &jfactory::getapplication();
$product = $app->getuserstatefromrequest('mypluginname.product', 'product', 'default value return if no session variable or request variable found');

ian





Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい