Page precedence problem

I am new to meteor.
I have 2 html files in my project.

  • Project\client\main.html
  • Project\client\views\EnquiryForm.html
    I need main.html as a home page. But it always displays EnquiryForm.html.

Is there any way to change the precedence without changing the name of the html files?

The files shouldn’t really make a difference, how are you handing the templates within those files?

File precedence has an impact with JS and CSS, but the HTML templates shouldn’t matter… unless I am forgetting something.

Are you using a router (Iron or Flow) to handle the ‘home page’ route?

Thank you for prompt reply.
Currently I am not using any template.
Below are my files.

///// main.html ////



  {{> loginButtons}}


  <title>Hello Enquiry Form</title>


I am not using any router. If the issue can be solved with router please also suggest one.

Thanks for your help in advance.

Ahh you only should have 1 <body> tag across all templates.

Then to switch which template is being shown it is easiest to use a router.

Instead of having two <body> elements, structure it like this:



  {{> mainpage}}

<template name="mainpage">
  {{> loginButtons}}

<template name="otherpage">
    Another Page Here

I would recommend reading up on Iron Router, or FlowRouter though.
Without them, you would need to use Blaze.render('otherpage') to change templates, either via a button or something.
Router makes it easy because it uses the URL path to choose templates.

Thanks cstrat…I will try try with single body tag.
Will update accordingly.
Thanks for your help once again :relaxed:

Thanks cstrat…Its working…I will definitely read on routers for navigation.
Also would like to know about nice UI compoenents that can be used for web app using meteor.
I found UI designing with CSS bit time consuming.

Try Semantic UI! Good, relatively complete set of UI components, relatively little markup required, has an official, well-working Meteor integration package!

EDIT: And by “Try XYZ!” I mean to say that it’s something that I’m using and finding that as of right now it’s the best - easiest to use and easiest to adapt - markup-based UI framework that’s reasonably complete in terms of what components it offers.

Thanks seeekr…will check Semantic UI.

I have some queries regarding my first meteor app…
I have used {{> loginButtons}} for login after adding accounts-ui and accounts-password packages.

How can we navigate from this UI on successful login?
Navigation needed as below:

  • On successful admin login, a page will be displayed with few operations and will be having full access on mongo collection
  • on successful other logins will be allowed to view the reports.
  • on login failure an error message will be displayed

I tried using iron router but could not understand how to integrate it to fulfill this requirement.

Need some guidance to proceed further.

Basically you don’t even need iron:router for this. Your template should just check if Meteor.userId() is set (through a helper) and if it is, then display not the login buttons but the actual content, depending on whether the user is an admin or not. Create another template helper that will help you determine that in the template.
And that’s it basically.

For iron:router you should definitely make sure you understand how the whole thing works, i.e. what are routes, views, and how you configure those. Googling for “iron router example” for instance yields a number of good resources right at the top. If I were in your shoes I’d accomplish what you need without iron:router and only afterwards take whatever time you need to learn about it and understand it and only then introduce the additional complexity. (Which is worth it, of course, once your mind is not actually occupied with learning other basics any more!)

That’d be my take on this, hope it helps! :panda_face: