I am a newbie to meteor. I wonder how meteor works without directory structure. Usually web server runs index file in default, and MVC frameworks have route, controllers, model and view in a specific directory structure with file naming. I understand somehow meteor identifies Client code by Meteor.isClient and Server code by Meteor.isServer. I want to know how it identifies default index file? And explain me how the structure works?
There is no index. From the docs:
When your app is loaded, it automatically renders the special template
called <body>, which is written using the element instead of a
. You insert a template inside another template by using the
{{> inclusion}} operator.
<!-- in myapp.html -->
<body>
<h1>Today's weather!</h1>
{{> forecast}}
</body>
So put your tags in any html file and it will find them. I usually put them in a file called body.html so I know where they are.
As far as structuring your app, again from the docs
You don't always have to use Meteor.isClient. There are some special folders in Meteor. Two of them are client and server. Putting code in these folders will load that code only in the client or only in the server. There are more special names explained in the documentation.
Related
I am porting a website from MVC4 to ASP.NET Core 3.0
My major views have view specific complex script files which I used to put in the /Areas/AreaName/Scripts/ directory and access them with something like.
I used to put these in a script directory in the area.
<script src="~/Areas/AreaName/Scripts/*ViewName*Scripts.js"></script>
Doing that now results in a fully dedicated file name like
<script src="C:\Users\..\..\..\..\*ViewName*Dripts.js"></script>
Which is clearly not the way to go for obvious reasons.
Do all scripts including view specific scripts now go in the ~/wwwroot/... directory
Static files are stored within the project's web root directory. The default directory is {content root}/wwwroot . The simplest way is create area folders in wwwroot\js , and add area specific js flies into corresponding folder . You can also serve files outside of web root(/wwwroot), see document for code sample .
I am trying to add
<meta name="google-site-verification" content="WcGeoFJE8eKgXlxMoHRDpJz1bpPFMGh25PK8M-eDlAw" />
to the section within my layout.twig . I've saved the file and uploaded it to the development version of the web site. But this HTML isn't being included.
All the other entries within the section are Twig codes. Not HTML. I am unsure if I have a cache issue and the revised version of my layout.twig isn't being loaded or if there is some Twig code I should be using for this tag?
Instead of modify the code of your application, I suggest you to proceed to the site verification with the Google file HTML verification procedure.
Simply add the Google files in the web root folder of the project, as example:
./web/googlec1f59ff86d15c795.html
And commit with your source file. In this manner the deploy procedure don't remove your files.
Another good practice, as suggested by # Pazi ツ is to act with the DNS configuration (this require you can manage the DNS site configuration).
Hope this help
I'm importing a external web template I found in bootstrap to build a intro page. It has it's own js, css , html files.
However I found it is troublesome to transfer the beautiful external web to meteor format by hand. How you deal it smartly?
Now I only can figure out that replacing the html() when the intro is created. (although I still don't know how to do it exactly )
Template.intro.onCreated(function(){
$('html').html('the external code');
});
The simple and dirty way is to put all js, css, and html into public\ directory of your meteor app since this directoy is served "as is"
After that you can start converting your js files (taking into account local and global namespaces) and convert html files into Handlebars templates. Converted files you should move to client folder. Css files you can put in client folder to allow its minification and remove references to css files from Handlebars templates of html pages.
/public folder is usually used for static files like images. I suggest putting everything in a client folder. Usually there will be a lot of redundant js files coming with the template (bootstrap, jquery, fontawesome, etc). Best thing to do is use http://atmospherejs.com/ packages for those libraries and you will most likely be left with the templatename.js file which deals with the html within that template which you'll have to "meteorise"
I have a problem with Struts2, the problem is, the client want the styling of the web apps is dynamic, for example is, i can put the template (.html / .ftl) on /apps/template/path where all the logic on war, can i do that?
i've been searching all over google and that style of code is belong to freemarker. but if using freemarker, i have to code using servlet (i dont wanna do that).
Can you give me the hint/solution, or it really cant be in Struts2?
if using freemarker, i have to code using servlet
No, FreeMarker doesn't need Servlets instead of Actions.
FreeMarker is fully integrated in Struts2, it just needs the library in your libs directory and some little configuration in struts.xml and web.xml.
According to Struts2 documentation,
Template Loading
The framework looks for FreeMarker templates in two locations (in this
order):
Web application
Class path
This ordering makes it ideal for providing templates inside a
fully-built jar, but allowing for overrides of those templates to be
defined in your web application. In fact, this is how you can override
the default UI tags and Form Tags included with the framework.
In addition, you can specify a location (directory on your file
system) through the templatePath or TemplatePath context variable (in
the {{web.xml)}. If a variable is specified, the content of the
directory it points to will be searched first. This variable is
currently NOT relative to the root of your application.
So, if you want to use .FTL files (FreeMarker Templates) INSTEAD of JSP files, you can put them outside the ear, in the file system.
Like this (web.xml):
<!-- FreemarkerServlet settings: -->
<init-param>
<param-name>TemplatePath</param-name>
<param-value>/apps/template/path</param-value>
</init-param>
I made a new page in our website that needs to access some functions that are in App_Code/modFunctions.vb. I tried simply calling the functions but it says not found in current context. So here are the file locations, starting at the root of the site:
/App_Code/ModFunctions.vb
/users/export.aspx
export.aspx is my C# page that I need to call the functions in ModFunctions.vb, how can I link them together?
You should be able to access the functions inside App_Code with no trouble. Make sure to either qualify it with the namespace or do an Import of the namespace.
If that doesn't work for you, post code on how/what you are trying.