Missing theme after switching to from HTML to Freemarker - html

I am relatively new to freemarker and I am trying to convert a .html file, that displays correctly, to a .ftl file.
The conversion of the main part of the web page went great (all the elements are there), except for the theme (background) of the web page. It doesn't display, but it was in the html.
My theme is just a link that points to a .min.css file.
<link rel="stylesheet" href="../static/themes-dist-4.0.27-theme-gcwu-fegc/theme-gcwu-fegc/css/theme.min.css">
I am trying to understand if you can pass "html to ftl" straight?
Also, can you display a theme in a ftl file?
EDIT:
The answer to this was to put the file into a public directory (ressources/public/themes/*). The compiler picked it up from there.

You might need to understand that FreeMarker template files are executed on the server, and the browser just sees the output as regular HTLM. Thus, you can simply rename a .html to .ftl (or rather to .ftlh), and since it contains no FreeMarker directives, that template simply prints the original HTML as is.
Check on the developer panel (usually opens with F12) of your browser if the CSS file was successfully loaded. The CSS file is (usually) not a FreeMarker template, just a "static" file, so it's unrelated to FreeMarker (though of course it can also be generated by FreeMarker if you need dynamism there).

Related

How to create non Django files in the static files template in a Django Project

I have a folder in my Django project called "templates", its linked to my main project which can access the files (HTML...) correctly as I can make it display stuff like "Hello World" but the project considers the files in the folder as Django files even though when creating them I typed stuff like main.css or main.html. The issue is it doesn't tell me if I have errors and it doesn't let me auto-fill so I was wondering if there was a way to fix this.
Picture of my Project
On the bottom lower right on your attached picture where it says django.txt, press it. This opens the select language mode utility function. Choose auto detect or the extension if you know it.
This automatically detects the file type and changes it to html or css; depending on the file type.

Include standalone HTML page in sphinx document

For most of my project's documentation I prefer a standard sphinx layout. However for the landing page I would prefer to use custom HTML/CSS/JS without any of the layout, TOC, or sidebars of the normal sphinx site. Is there a way to include a raw HTML standalone page in a sphinx-generated website in a way that completely disregards the normal layout of the rest of the site?
As a counter example I know that I can include raw HTML bits into a page using the following (see also this question)
.. raw:: html
:file: myfile-html
However this just embeds a file within the normal layout. I would like to have a completely standalone HTML page.
I just ran into this problem myself, and the way I solved it was to simply include the html file in my source/_static folder, then refer to it with a relative link.
So if source/_static/my_standalone.htm is the path where I have my non-generated HTML file, and the .rst file where I want to type my link is at source/otherfolder/index.rst, I write it like this in my rst:
Link to my non-Sphinx HTML file
===============================
To get to my standalone, non-generated HTML file,
just `click here <../_static/my_standalone.html>`_ now!

MEAN JS - where is the main html file (index.html) located

I just started learning MEAN JS and I am trying to find the html file for the main page. However I only see home.client.view.html and header.clinet.view.html in the view folder.
From what I know is, usually there is a main html which holds all the information of the home page, and we can add links of CSS files and JS files in the main html file.
How can I add links of extra CSS files and JS files in MEAN JS since i cannot find the main html file?
The MEANJS top level page is located under server/app/views/layout.server.view.html and is where you set header meta tags. Most everthing else on the page is programmatically inserted by angular, such as links to CSS files and Javascript files.
Any of the CSS or Javascripts files under your server/public directly are automagically added to the page. If you wish to add other, third-party scripts or stylesheets, you do so by editing your server configuration file, located at config/env/all.js.
So for example, to add the angular version of the tinymce editor to your MEANJS site, you'd edit config/env/all.js by adding CSS to module.exports.assets.lib.css and references to the tinymce editor and its angular wrapper to module.exports.assets.lib.js.
You will need to restart your server (via the 'grunt' command) if you change this file while the server is running.
UPDATE
Using mean-cli#0.6.1 to scaffold a new mean project, the default "top-level" page is located under packages/custom/meanStarter/public/views/system where you will find two files:
header.html - which describes the layout of the default navbar
index.html - which lays out the content of the default page
Now, having said that, it should be noted that the "proper" way of configuring a mean server to display your own top-level homepage is to create a new mean package.
See the docs for further information.

Joomla HTML validation

I am trying to validate the home page of my Joomla. The issue is that I have the site on my local host so I can not simply copy the URL into http://validator.w3.org/ to validate.
My next thought was to open the index page in my browser and then run firebug to access the source code, and then copy and paste the code into the validator.
This seemed to work okay however when the code returns errors, I now don't know where to access the html to correct them.
Thoughts?
If you have not much knowledge about the way Joomla works, you will have to learn about the file locations.
Normaly, most changes should be done on the index.php file located in your template folder (root/templates/name_of_your_template/index.php)
If the changes you need to make aren't located in this file, you can have a look at the modules, component or plugin files that output these error and that becomes more serious.
If there is a template override for the module/component/plugin you need to modify, the files should be located in root/templates/name_of_your_template/html/name_of_the_module_component_or_plugin
If there is no template overide for the module/component/plugin that outputs the error, you will have to learn about template overrides.
Depending on your browser, there are many extensions that will validate non-accessible (i.e. localhost) pages
In Google Chrome - https://chrome.google.com/webstore/detail/html-validator/cgndfbhngibokieehnjhbjkkhbfmhojo?hl=en
Once it's installed, click on the icon and validate local page.

How to use #RenderPage to include CSS content inline - MVC Razor

I am currently exporting a page from my project into Excel which will not allow the linking of external content e.g. external CSS.
What I am trying to achieve is a simple way to include a CSS file in my view but to have it called directly from a CSS file which will have automatically been minified by Visual Studio.
So, in my view I have tried this:
<style type="text/css">
#RenderPage("~/CSS/_ExportStyles.min.css")
</style>
but doing this returns the following error:
Server Error in '/' Application.
The following file could not be rendered because its extension ".css"
might not be supported: "~/CSS/_ExportStyles.min.css".
What I know will work would be to place the CSS in a normal .cshtml file and include that, but I would lose the ability to ".min" the file which keeps the file size small and allows me to automatically strip out comments etc.
So, it turns out that #RenderPage is not what I was looking for...
what I needed is this:
#Html.Raw(File.ReadAllText(Server.MapPath("~/CSS/_ExportStyles.min.css")))