Giter VIP home page Giter VIP logo

Comments (7)

lestrrat avatar lestrrat commented on August 29, 2024

Thanks :)

If you're asking for a per-request thing, no C::V::Xslate doesn't do it, and until Text::Xslate changes, it never will.
Unfortunately Text::Xslate as of today does not allow to change the path component.

If what you want is a per-request thing as above, under what circumstances would you need it?

from catalyst-view-xslate.

 avatar commented on August 29, 2024

O, ;( Bad...

I need to change path of templates according Host header, cause my Catalyst application is used for more than one sites at one time.

from catalyst-view-xslate.

 avatar commented on August 29, 2024

With TT it's easy (changing templates path per-request), but TT is very slow. :(

from catalyst-view-xslate.

 avatar commented on August 29, 2024

I've found a solution at #catalyst (thanks t0m):

In MyApp::View::Xslate

before process => sub {
my ($self, $c) = @_;
$self->path([$c->stash->('additional_template_paths')])
};

And it works perfectly. Could you add this solution to the POD?
And for cache it will work too.

Also about POD improvement. What about adding:
PACKAGE->config(expose_methods => [qw(foo)]);
Because there is a missunderstanding how to set expose_methods in MyApp::View::Xslate.

from catalyst-view-xslate.

lestrrat avatar lestrrat commented on August 29, 2024

Yeah, that works, but it completely takes away the performance gains that xslate offers, because
it re-creates xslate object instance for each time you call that.

Xslate works best when used in a persistent environment, so that it can utilize its internal
cache mechanism. see http://xslate.org/benchmark.html.

So no, I don't want to put it in the docs, as it gives the false impression that this can be
done without much penalty :/

I don't really understand why you would need to change the settings for xslate for
each request. However, if the configuration pattern is within a reasonable amount
(i.e., you have may be a couple of paths that you want to switch between), then
it might make more sense to implement MyApp::View::Xslate1 and MyApp::View::Xslate2
so you switch xslate instances depending on the request.

from catalyst-view-xslate.

 avatar commented on August 29, 2024

Good idea. How to switch depending on the request in the Catalyst? I don't know.

from catalyst-view-xslate.

lestrrat avatar lestrrat commented on August 29, 2024

$c->forward('View::CustomView');

from catalyst-view-xslate.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.