To write some data to the session, use $this->Session->write(name,
data)
To read from the session: $this->Session->read(name)
To check if a variable exists in the session or not: $this->Session-
>check(name)

For more info, have a look at Cake's API.

On Jul 5, 7:36 am, r557 <[EMAIL PROTECTED]> wrote:
> I'm creating a shopping cart to extend a current project completed in
> CakePHP.
>
> I'm having some issues with regards to understanding how Sessions work
> around CakePHP and how to use them.  The trouble i'm having is, I am
> not able to find some practical examples regarding how to store
> session data around Cake.
>
> For example, i have a controller:
> <?php
> class ProductsController extends AppController {
>
> function view($id = null) {
>                 $this->layout = 'main';
>                 if(!$id) {
>                         $this->Session->setFlash('Invalid id for Product.');
>                         $this->redirect('/products/index/');
>                 }
>                 $this->set('product', $this->Product->read(null, $id));
>         }
> ?>
>
> /******** view.thtml ************/
> <div class="product">
> <h2><?php echo $product['Product']['name']?></h2>
> <?php echo $html->image('sundaymorning_cover.jpg', array('class' =>
> 'product_img')); ?>
> <dl>
>         <dt><?php echo $product['Product']['name']?> - $<?php echo
> $product['Product']['price']?></dt>
>         <dd><?php echo $product['Product']['description']?></dd>
> </dl>
> </div>
>
> I'm looking for a starting point to begin the process of integrating a
> Shopping Cart Using Sessions.  Not looking necessarily for a complete
> how-to (would be nice if possible :)) but all i'm really looking for
> is some assistance on how to integrate this.  I haven't found much on
> this topic as of yet, but if someone has any good resources please
> share.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to