Ask Your Question
2

How do we include "external" templates in our custom skin?

asked 2011-06-14 11:18:21 -0500

Martin Burchell gravatar image

Hi

We've created a custom skin and we're trying to base our skin on templates used elsewhere on our website ie those present in TEMPLATE_DIRS. Is this a bad idea?

It looks like askbot is only looking in the skins directory for templates as it can't find templates in our application. Looking at the SkinEnvironment class in skins/loaders.py, _get_loaders() creates file system loaders for the custom skin directory. We can modify this to append TEMPLATE_DIRS to the loaders and it seems to work. Is there a better way to do what we want? I guess we could use symbolic links from the skin directory to the application templates directory but that seems a bit of a hack.

I suppose ultimately we're looking to embed askbot so that it looks like any of the other pages on our website so tell us if we're going about this the wrong way.

edit retag flag offensive close merge delete

Comments

TEMPLATE_DIRS are not looked into in askbot, because the idea is to support switchable skins, where skin has a name, contains templates and media.
Evgeny gravatar imageEvgeny ( 2011-06-14 12:02:39 -0500 )edit
Just tested the ASKBOT_EXTRA_SKINS_DIR setup. Worked for me, please take a look at the doc in my answer, I will be happy to clarify anything that brings questions.
Evgeny gravatar imageEvgeny ( 2011-06-14 12:23:17 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2011-11-15 05:00:46 -0500

Martin Burchell gravatar image
edit flag offensive delete link more
0

answered 2011-06-14 12:01:10 -0500

Evgeny gravatar image

Please take a look at this document, and please ask if anything is not clear (it was written just two days ago, and still is a bit raw).

http://askbot.org/doc/customizing-skin-in-askbot.html

You'll need to specify ASKBOT_EXTRA_SKINS_DIR and place the custom skin there.

edit flag offensive delete link more

Comments

Hi Evgeny. Thanks for your answer. We are using ASKBOT_EXTRA_SKINS_DIR and have put the custom skin in there. But we want our skin to be based on templates that exist elsewhere in our application and don't want to have to place copies of them in our custom skins directory.
Martin Burchell gravatar imageMartin Burchell ( 2011-06-15 03:53:11 -0500 )edit
I see, maybe there is a way to reconcile the differences in the skin approach and the traditional method. Maybe the way you suggested - by appending TEMPLATE_DIRS inside the skin loader... will need to look.
Evgeny gravatar imageEvgeny ( 2011-06-15 04:08:30 -0500 )edit
Thanks. I think we're going to hit another problem because we're not using jinja2 for our templates so it might be that we'll end up having to replicate modified versions of our templates in our custom skin directory after all. Either that or fix our templates to be compatible with jinja2 but that will be a lot of work.
Martin Burchell gravatar imageMartin Burchell ( 2011-06-15 05:50:40 -0500 )edit
Yes, this is an issue, bridge template tags would be needed to connect django and jinja2 templates properly. In askbot there is a template tag "include_jinja", that includes contents of jinja template into the django template, but it had limited testing so far. For a full suite we'd need extends_django, extends_jinja2 and include_django, especially I think "extends" type tags are important. I've seen 5-fold speedup of rendering across the board when switched. One gotcha with debugging jinja2 templates - you must have DEBUG=True and TEMLPATE_DEBUG = False.
Evgeny gravatar imageEvgeny ( 2011-06-15 12:55:29 -0500 )edit
the tag should be called include_jinja2, I'll rename it.
Evgeny gravatar imageEvgeny ( 2011-06-15 12:56:09 -0500 )edit
0

answered 2011-11-29 22:43:36 -0500

Roland gravatar image

Please take a look at this document, and please ask if anything is not clear

google

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-06-14 11:18:21 -0500

Seen: 335 times

Last updated: Nov 29 '11