[jifty-devel] passing variables between components

bart bunting bart at bunting.net.au
Mon Mar 20 03:25:07 EST 2006


Yet another question :)

I'm a little confused and stuck about exactly how I'm meant to pass
variables from component to component.  

To give a little background:
I have a model called Category which is a list of ids and names of
categories.

I have another model ProductCategory which is a mapping from Product
ids to categories, i.e. 1 product can belong to multiple categories.

I'm trying to have a link from the edit categories screen which links
through to the edit category members screen, passing the category id.

I'm having trouble understanding how I'm meant to pass through the id
of the category.  I need the id of the category to show products
belonging to that category etc.

The init section of the edit category members is:

<%init>
$id = Jifty::Web->get_variable('id');
my $products = BestBuds::Model::ProductCategoryCollection->new();
$products->unlimit;
$products->limit(
	column => 'category',
        operator => '=',
	value => $id
	);

</%init>


And it is called from a link on the edit categories page as follows:

 %    Jifty->web->set_variable('id', $id);
<%
    Jifty->web->tangent(
        label   => "Edit Members",
        url   => "/admin/CategoryMembers",
        )
%>

I'm not sure if this is the right way, actually I'm pretty sure it
isn't as it doesn't work at all :)).

I guess I'm not sure what is passed through when using a tangent or
clickable link.  Is there anywhere in the documentation that I should
look or alternativly I'm happy to try and write something if/when I
understand how this works.

The docs indicate that state variables are passed as a tangent is
really just a clickable but maybe I'm using them incorrectly?

I've tried using an arguments hashref as one of the args to tangent
but that doesn't seem to work either.

I'm sure this will be very obvious once I understand it but at the
moment I'm stuck.

Thanks for any help/explanations.

Regards

Bart


More information about the jifty-devel mailing list