I want to create a universal header (and footer) using HTML/CSS/Javascript so that if I update it to one page, it automatically updates on the rest. I also want to be able to choose which link is showing up with the active class on it. Also, I am using bootstrap. Here are some criteria I need to meet:
No PHP
No Server side (must work on github pages)
Thank you in advance,
Albert
You can use jQuery to .load a HTML file:
HTML
<div id="header"></div>
jQuery
$('#header').load('static.html');
Alternatively, you could use iframe to load your static header. See this answer for more information regarding the available techniques.
Maybe try Jekyll, this is a tool to generate static pages, also this is how the githup page handles your own personal page. You just follow the file structure and set the layout properties in your files, then you can use the universal layout (including header, footer etc.) in your page.
Here is a link to Jekyll.Jekyll
Related
I need to make a webpage where the main.html loads a page with a header and footer that will remain steady after I click on some navigation links, but only changing the body content, all this, using Javascript. The body content comes from another html document in the same folder. I've seen some answers to this, but very old ones using PHP. Please help.
BTW, I'm not using server yet, only loading from file with Chrome. Basically I want to replace the whole body of the page with the body of another html.
You can change part of a website by javascript and load content from other urls using ajax.
https://www.w3schools.com/js/js_ajax_intro.asp
And you can use jQuery lib to perform the ajax calls:
https://www.w3schools.com/jquery/jquery_ref_ajax.asp
The ajax calls can be to a server (this includes firebird and other content from the cloud) or to some files of yours.
It's not the only way, you could also have a look at iframes to see whether they fit your needs.
I have the following problem.
I have a typo3 page without any template I made by myself, but it gets in some way the style and the behavior of the other pages (I mean navigation, footer and so on). Now I have written some HTML inside the page by creating an HTML element.
In this HTML element, I included some js-code, which uses jQuery. The problem is, that the page loads the jquery at the footer and my scripts are loading before (in the HTML element). So my script does not recognize jQuery. How can I add my scripts at the whole end of the page? I know, that it has something to do with templates, but when I create a new template for the page, the whole content disappears.
Would be nice to get any help.
Cheers,
Andrej
It is usually good practice to read all your JS from a single file placed in the footer of the page. Add this to the setup section of your page template:
page.includeJSFooter.scripts = fileadmin/js/scripts.js
Then remove the JS from the HTML template and put into this file. This file could hold all your custom JS and possibly even all the libraries you use on the page (if you are not loading them from a CDN).
Bonus: the JS doesn't have to be re-loaded on every page view but can be read from cache.
For reference: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Page/Index.html#includejsfooter-array
I hope by template you mean a template record where you store your TypoScript? Otherwise this answer is not what you are looking for. :)
You can just add an extension template on your page that only adds to the rest of the TypoScript but does not override anything. To do so, go to the template module, choose "info/modify" in the dropdown at the top and use this button
Explanation: an extension template has the checkboxes for clearing the constants and the setup not checked and will not mess with the rest of your site's TypoScript:
I want to create a site like any other. I want the "thing" at the top (home downloads and stuff) to be on all my pages. Do I need to copy and paste the same code over and over again?
put the common part in your header/some specific file and use ,since you will be using header/some specific file on all pages so the desired content will also be loaded.
Learn Psd to html conversion For batter understanding the divs and styles modification and customization.. your divs and tags can be easily maintained with your stylesheet by giving id and classes you can also give one dive multiple classes and ids,
you are talking about master page i think
that is one in style and in that page you're showing other page, likely we can say one template page and many functionality see this and
see this
As far as I'm concerned pretty much all the intelligent options for solving this problem are mentioned in this question
Use a server-side template (e.g.php), use a client-side template (e.g. handlebars), use javascript, or you could use a static site generator like Jekyll.
How can I read XML file on html page.
i want my XML link value to go in anchor
tags href attribute and Name of the website
between the anchor tags
I just know very basic Javascript.
I am trying to change value in footer of my website using XML because i have more than 100 pages and every time I change something in footer I have to change all 100 pages manually that's why i want to change the footer links through XML.
Please explain by showing code page should look like this
<div>
<a href "this value should be read by xml">and this value should also be read by xml</a>
</div>
Thanks guys for your answers but after a lot of search i found exactly what i wanted. I wanted to change multiple pages footer section using single file without changing my pages name (from .html pages to other like .aspx,.php,.asp) I thought using xml would be a good way but i am really novice in this field and xml didnt work for me (or say i am unable to use it in proper way) therefore i found out an alternative to change to content of multiple html pages using single file. All i needed to do was use SSI aka server side includes. The only thing you need to do is check if your server supports SSI or not and then make an individual html footer page that you want to include on every page. In order to include that external footer page just type.
<!--#include file="footer.html" -->
in the area,div,table wherever you want your footer to load and its done .
For detailed article pls go to following link http://httpd.apache.org/docs/2.2/howto/ssi.html
The company I am working with hosts their webpage on Wordpress. They want me to edit some of the code in order to do various things, such as enable a photo container to be a moving slideshow.
Figuring out the javascript and html to achieve the results they desire is not problematic for me. However, I am unsure how to get full access to the Source Code of the site. I have privileged access to the backend of the site but in wordpress when you go to edit it only shows some of the basic html tags while hiding the <div> and <script> tags and code. Is there any way edit the page in its source code format? I don't want to have to go through the simplified and less expressive/less control Wordpress interface, and I don't even know if I can achieve the desired results with it.
If you try and edit individual pages you're approaching the problem in the wrong way. You probably want to be using a plugin or modifying a plug-in to create the slideshow you need. There are many plugins for wordpress that do what you seem to need.
slider-widget is one such pluging
In Wordpress, there are two main parts to the website's front and backend: the core WP files and the theme that is used. (And other important aspect to a WP site is the database, where all content is stored, including text/images entered in the admin backend.)
Core WP files are not to be changed because they get overwritten with each update. What you want to work with is the theme. Look in Appearance>>Themes and see what the active theme is for the site. It will also tell you the name of the folder the theme files are in.
With FTP, go to root/wp-content/themes/your-theme-name. That's the php, html and css source of the displayed part of the site. Uploaded images are in /uploads/, and plugins in /plugins/.
See http://codex.wordpress.org/Theme_Development to get an idea of how themes are built and how to modify them.
See the rest of the docs at WP to see how to work with plugins, add other javascript correctly so it doesn't conflict with WP's included javascripts, etc. All the docs you really need are at wordpress.org