Hi all,
I wonder if anyone can help me or point me in the right direction. I have used Piwigo to develop a greetings card website for my partner and I love the features it offers. I've used the Stripped theme as a starting point and the sight now looks great.
However, I have one little problem. I use a Session variable to store the array for the shopping basket, and to create the View cart and Checkout windows I've used Additional Pages plugin.
This is where the problem begins. I have successfully started a new session for my cart windows but I ideally want to be able to show a cart icon with number of items shown against it in the header section of each window. I've used the header region in the Options menu to populate the header but I cannot access my new $_SESSION array to show the contents on any window but the cart ones I've developed.
My question is, how can I implement Session variables that will be accessible throughout the Piwigo site? I assume the main one used is 'pwg_id' so I don't mind piggy backing off that one if required, but anyone got any ideas how Piwigo uses session variables and how to reference them throughout the site?
Many thanks in advance for any help offered!
Cheers,
Simon.
Offline
Hi
As a quick answer from my midnight bed, search "session" in Piwigoffiles to find the piwigo functions to set and use session variable
Offline
Thanks flop25, I'll look at that when I get a break from work!
Cheers,
Simon.
Offline
Check out
the functions inside http://piwigo.org/dev/browser/trunk/inc … on.inc.php
Offline
Thanks for the info flop25!
Unfortunately I don't think I'll be able to use these functions as I have a Session array (maybe I should have mentioned that?!) so I don't think I'll be able to store that in the database without either splitting out each separate variable within the array or changing it to store each entry as a comma delimited string?
I do have my own $_SESSION['shop'] array defined and it works well in my shopping cart windows, but I'd love to be able to access it throughout my piwigo website.
Really appreciate your input flop25, so thanks!
Offline
you could juste serialize your array
pwg_set_session_var('key', serialize($some_array));
$some_array = unserialize(pwg_get_session_var('key'));
Offline
Thanks mistic100, I'll give that a go.
I actually managed to get it to work with a combination of Javascript and php, setting a Javascript variable with the relevant value(s) of my array from within the php code. Seems to work nicely, but like I said I'd prefer to use the piwigo session, so I'll look at your solution too!
Thanks again chaps!
Offline