meteor - inject context and markup into another template -


my meteor application has following basic layout:

<template name="layout">   {{> header}}   {{> yield}}   {{> footer}} </template> 

my header template contains full-width header:

<template name="header">     <div>         <!--implementation of full-width header-->         <h1>{{pagetitle}}</h1>         <!--insert custom html here, e.g. search input or options (see screenshot)-->     </div> </template> 

then, have multiple yield templates, that's main content goes. each of yield templates, want able load custom content "into" header template:

  • set pagetitle attribute, have custom title on every routed page
  • insert html content, e.g. show extended options (in example it's filtering result of query, it's html content)

what's best way this?

for better understanding include screenshot of how page looks like: screenshot skeleton

edit

i came following. add base template layout, let's call headeryield:

<template name="layout">   {{> header}}   {{> headeryield}}   {{> yield}}   {{> footer}} </template> 

all custom markup go there, disadvantage, need 2 custom templates each view.

this question isn't clear. question how can include header template? if answer...

<template name="header">     <div> <!-- abosolute position full div --> </div>     <!-- markup here brah -->  </template> 

now if question how can include page title? if answer...

router.route('/user', {   onafteraction: function() {     document.title = 'page title';   } }); 

this assumes have iron router package installed. iron router controls template gets rendered when looking @ particular pages. example route "/user" sent template choose. if want information on how install iron router or can can see documentation. it's necessary meteor applications: iron router

update:

after looking @ profile other questions include iron router have used before. confused question is.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -