Trying to separate my back-end codes in my front-end(Wordpress) - html

I created a form that would send the data to an email address and I'm trying to figure out on how to separate my back-end from my front-end in Wordpress. They said i should use get_template_part(). Do I code this inside my functions.php or is this a separate file?

This should answer that: http://codex.wordpress.org/Function_Reference/get_template_part
Load a template part into a template (other than header, sidebar,
footer). Makes it easy for a theme to reuse sections of code and an
easy way for child themes to replace sections of their parent theme.
Includes the named template part for a theme or if a name is specified
then a specialized part will be included. If the theme contains no
{slug}.php file then no template will be included.
For the parameter, if the file is called "{slug}-{name}.php".

Related

How to load different parts of a web-page from different html files

I am making a local website where I have a number of pages with a lot of common code for header, navigation bar and footer.
I was wondering if there was a way I could use to store the header, footer and other such codes as independent html files, and then simply link them in the code for the new page.
You can use server-side includes for using an HTML file into another one. For that, you'll have to make a few changes in your server configuration as well. I'll show you an example of Apache.
Change configuration as mentioned in https://www.linuxtopia.org/HowToGuides/apache_ssi.html
Include the below code in your html file and replace "included.html" with your section html filename
<!--#include file="included.html" -->
Check more on : https://en.wikipedia.org/wiki/Server_Side_Includes

Jade: How do I create a layout or templates?

I'm designing few pages in HTML using Jade. I've problem while compiling common areas of the pages. Header, Footer, Navs etc. How do I create a template files and include it the files or how do I create a layout to use in all files?
I'm very new to Jade and couldn't find something related to creating a layout or templates to use.
In PHP for example you create header.php, footer.php and nav.php and include those in the files. One change affects all the other files. How to accomplish something like that in Jade?
P.S. I'm not using Node.js or Express.
You should have a look at the extends function in jade, that will allow you to extend the different files. Like include in php.
http://jade-lang.com/reference/extends/

Keeping the css styling of a custom directive in a separate file

I am learning Angular and I need advice on best practice, and a general direction for digging deeper in the subject:
I am trying to create a web app with Angular which is composed of a number of standalone widgets, and I decided to implemented them each as independent custom directives.
I would like to make these custom directives as reusable, movable, replaceable and cohesive as possible, and put all of their related html/css/js files in their own dedicated folders, with a folder structure of something like this:
What is the best practice for loading a separate CSS file for the template partial of a custom directive? (For example, should I load the CSS from the partial.html which will eventually appear in the html body? Should I look into merging my css files with Grunt upon build?)
You should build all of your CSS into a single file you. Without merging you require an additional request to the server and processing of the CSS which adds more time before the page can be rendered.
For additional loading performance you can combine all of your HTML fragments into a single file as well that you load up front.
<script type="text/ng-template" id="temp2.html">
<div class="view">
</div>
</script>

Integrating html and CSS files in Spring-MVC project

I am working on a Spring-MVC project. Currently I have a few classes in order and I can save the information in database and retrieve it. I now have a website template in HTML, CSS, JS, images. I would like to pull this template into my spring project. Structure is as follows. I would like to know in which order I should create the directories and where to place them, so references will be parsed without error.
Structure :
webapp/
|--resources/
|
|+-WEB-INF/
+--web.xml
+--classes/
+--spring/
|+--root-context.xml
|+--appServlet/
|+--servlet-context.xml
+--views/
user.jsp
The template I am using has this format of referencing information
img/products/name_of_image.jpg
<a href="contact.html"/>
css/css-filename.css
js/js_filename.js
The user.jsp is the landing page and I have already put the HTML code for home inside it. I would just like to know how to structure the directories so I can directly put all those files and the template will work. Thank you for your time.

Drupal site. How do I add custom js/css prettify.js/prettify.css for a drupal page?

I want to use custom css/js. I have moved these to the server. But the drupal page starts with a section. how do I add the custom css/js to my drupal site page. I have admin and just need to know what to do to get this included on the page. Please send exact steps as I am totally new to drupal. Thanks
"Custom CSS and JavaScript files" module allows to specify two folders, one for CSS and one for JS where the stylesheets and javascripts files are located respectively.
The module creates two sub-folders under your files folder:
files/customcssjs/css
files/customcssjs/js
Indeed, it's depend on your task, what css and js files should do, and adding these in custom module (drupal_add_js, drupal_add_css) or custom theme (info file, preprocess in template.php or directly in page-XXX.tpl.php and so on).