Questions tagged [template-inheritance]

59 questions
22
votes
2 answers

Error message "undefined reference to template function passed as template parameter"

When I pass a template function as a template parameter of a base class, the linker complains that it cannot link the function: #include template inline int identity() {return I;} //template<> inline int identity<10>() {return…
Ferenc
  • 779
  • 1
  • 6
  • 14
15
votes
2 answers

Jinja's loop variable is not available in include-d templates

I have code similar to the following in one of my jinja template {% for post in posts %} {% include ["posts/" + post.type + ".html", "posts/default.html"] %} {% endfor %} which is supposed to render each post inside the posts collection,…
sharat87
  • 7,330
  • 12
  • 55
  • 80
13
votes
10 answers

How to implement Template Inheritance (like Django?) in PHP5

Is there an existing good example, or how should one approach creating a basic Template system (thinking MVC) that supports "Template Inheritance" in PHP5? For an example of what I define as Template Inheritance, refer to the Django (a Python…
anonymous coward
  • 12,594
  • 13
  • 55
  • 97
8
votes
2 answers

Using Layout, Partials with Handlebars Template

How do I use layouts, partials with handlebars template like the following? I have looked at the partial docs but still could not figure out what I wanted to achieve. default.html The default layout is reused for the different views of the site.…
Ishan
  • 3,931
  • 11
  • 37
  • 59
7
votes
1 answer

Proper method for Django template inheritance of content

I have a base.html template with sitewide tags for charset, google-site-verification, stylesheets, js.... I also need to set up blocks for page specific title tags and meta descriptions. I am wondering, should I set up a {% block head %} in my…
shipwreck
  • 305
  • 3
  • 12
7
votes
1 answer

Laravel 4 - Extending a section declared in a master template more than once

I have a scenario where I have a master template which defines a header section. It looks like this... @section('header') {{ HTML::style('css/planesaleing.css') }} {{ HTML::script('js/jquery-1.10.1.js') }} …
Ben Thompson
  • 4,743
  • 7
  • 35
  • 52
6
votes
2 answers

Split paramter pack

I would like to split a template parameter pack. Something like this. How could I go about doing this? template< typename... Pack > struct TypeB : public TypeA< get<0, sizeof...(Pack)/2>(Pack...) > , public TypeA< get
5
votes
1 answer

What is the Type This struct is Inheriting From?

So this example from: http://en.cppreference.com/w/cpp/utility/variant/visit declares the specialized type: template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) ->…
4
votes
2 answers

Is it possible to make multi-level template inheritance in django templates?

I have three html-files: base.html page.html comment.html in page.html I extend base.html. In comment.html I extend page.html. Will comment.html extend base.html's blocks?
4
votes
3 answers

Combining Policy Classes - Template Template Parameters & Variadic Templates

I am wondering if it's possible to combine policy classes using variadic template-template parameters such that each policy may have it's own template pack. It seems like you can only share a single template pack amongst all policies but I hope…
4
votes
1 answer

Does any nodejs template engine support the template inheritance function like PHP Smarty?

Does any nodejs template engine support the template inheritance function like PHP Smarty? {block name=head} default layout content {/block} {block name=head} if page have customize the content it display the customize content, otherwise display…
3
votes
0 answers

How to pass data from child template to parent template then to included template in Django?

Basically what i want to accomplish is be able to access some variable or content from a template after performing extend then include. No better way to explain what i want to do better than a sample code so, home.html {% with page="homepage" %} {%…
3
votes
2 answers

Django: TemplateDoesNotExist error for base template

I learnt about Django template inheritance and was working on it. I made a base_post_login.html template in the same directory as other templates. and type {% extends "base_post_login.html" %} as the first line in in a child template. But when the…
sachsure
  • 828
  • 1
  • 17
  • 30
3
votes
1 answer

django template inheritance - views.py for multiple child templates

I am trying to create base.html and load several child templates named "nav.html", "contents.html" and "footer.html" on the base. I want to make all three child templates be loaded on the base.html page Whenever I visit…
3
votes
3 answers

How can you set a session-based variable in a twig base template?

I want to plug twig into an application that would need some session-based data incorporated in the base. For example, the client's current timezone shows in the footer. It doesn't make sense for the individual controllers to know about this, since…
Bryan Agee
  • 4,924
  • 3
  • 26
  • 42
1
2 3 4