[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Re: ANNOUNCE: CAP::LinkIntegrity 0.02


> >>   # in your TT template:
> >>   <a href="[% c.make_link('/account.cgi?rm=balance&acct_id=73') %]">
> >>
> >>   # or in your HT::Dot template:
> >>   <a href="<TMPL_VAR c.make_link('/account.cgi?rm=balance&acct_id=73')>">
>
> Isn't there a gotcha here, at least with H::T? I bet you would want to
> generate the "acct_id" dynamically most of the time, but at least with
> H::T you can't embed <tmpl_var> tags in each other, that I'm aware of.

However, you *can* pass params to object methods:

   <a href="<TMPL_VAR
    NAME="c.make_link('/account.cgi?rm=balance', 'acct_id', some_id )">">

(In this example, some_id is a template parameter.)

Unfortunately (for now), make_link expects this syntax:

    $self->make_link($url, { 'param1' => 'val1', 'param2' => 'val2' ... } );

...and, I don't think there's a way to pass a hashref in the parameter
list from within a template.  There's a similar problem with
make_self_link, which expects:

    $self->make_self_link(params => { param1 => val1 ... } );


So these methods aren't very friendly to calling from templates.

Maybe I should reorganize these to play nicer with templates.  (And while
I'm at it, 'make_link' is a bit combersome.  How about just 'link'?)

    $self->link('some_url', 'param1' => 'val1', 'param2' => 'val2' ... );
    $self->self_link('param1' => 'val1', 'param2' => 'val2' ... );


However, now I have to figure out how to access the path_info features
of self_link.  Currently, you can do this:

    $self->make_self_link(
        path_info => '/some/path',
        params    => {  foo => 'bar' }
    );

And you can also do this:

    $self->make_self_link(
        keep_path_info => 1,
        params         => {  foo => 'bar' }
    );


So do I add another function for this instead?

    $self->path_info_link('/some/path', foo => 'bar');


As for the option of keeping the current path_info, do I just make that
into a configuration option which is turned on by default?  Thinking
about it, I'm assuming that most people would expect that
$self->self_link would include the current path info.

Damn it, I *knew* I should have made version 0.01 into a developer
release!


Michael


---
Michael Graham <suppressed>



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.