I want to set up a method accessed from the request object
that will allow me the option to create a page title based on
the path to the page.  What I was thinking was:


In your page you say

[! Execute ({isa => 'title.epl'}) !]

In your title.epl you say

[! Execute ({isa => '../title.epl'}) !]

That should do the the trick of setting up @ISA

BTW. I would use

<title>[+ $req->title() +]</title>

And then return the title string instead of print OUT

Gerald

I was able to get this working with one minor modification. I had to concatinate the call to $self->SUPER::title() with the title string being returned by the function in order to see both. Otherwise, I didn't see the text from the parent method. i.e., my index.html was:

[! Execute({isa => 'title.epl'}) !]
[! sub title {
    my ($self) = @_;
    $self->SUPER::title() . ' Page'
} !]

This works - but then I realized that if you don't override the title () method on the individual pages, then you'll only get the title from the base.epl. It won't print the recursive titles from title.epl unless the requested page begins that recursion. So I thought I would reverse my logic a little. What if the base.epl started the recursion on title.epl. Then if my designers forget to add the title() override to their pages (which is highly likely) they will still get all titles up to that folder. Here is what I tried:

/base.epl
[! Execute({isa => 'title.epl'}); !]
[! sub title {
    my ($self) = @_;
    'Base' . $self->SUPER::title()
}; !]

/title.epl
[! sub title { ' : Level 0' }; !]

/foo/title.epl
[! Execute({isa => '../title.epl'}); !]
[! sub title {
    my ($self) = @_;
    $self->SUPER::title() . '' : Level 1'
}; !]

/foo/index.html
[# Nothing Here! #]

Here, hitting /title.epl stops the recursion rather than /base.epl like in my first example. The only problem is that apparently the Execute isa in the base.epl does not have the Embperl::Object behavior of looking in the directory of the requested file. It seems to literally be including only the /title.epl because when I request / foo/index.html I get the title "Base : Level 0". Is there anything I can do to make the Execute isa in the base.epl actually include the title.epl in the requested directory?

-Derrick



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to