HTML Adding subpages(children)? - html

I don't know if it's the fact I don't know how to phrase it or something, but I can't seem to find out how to add subpages.
I don't mean pages apart from the index, I mean this:
"www.example.com/portfolio" links to "www.example.com/portfolio/art"
rather than:
"www.example.com/portfolio" links to "www.example.com/art"
Any help would be appreciated, thanks.

You will need to use .HTACCESS with URL Rewrite method.
There are quite a few articles out there but you can check this one out;
http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
You will still need to create the HTML pages but the display will be different.
Honestly, there are multiple ways to accomplish what you are asking for and one other method is to do it with JQuery. You can change the URL and load the HTML inside the div. The best approach would be to use footer and header as static and load the HTML pages inside the body.

Related

HTML/CSS - is is possible to have a html website with multiple pages - but only one menu (indentical) that can be called?

To start off with I can only use HTML and/or CSS. I do not have the capacity to use PHP or JavaScript?
I have researched an iFrame, but I'm not sure if it is possible to have a dropdown menu with an iFrame?
There's a very old-hat way of doing this called framesets, beware this is very old, doesn't look great and I'm not sure if it'll work well with dropdown menus e.t.c.
http://www.w3schools.com/tags/tag_frameset.asp has more on it.
Other than that the only thing I can think of is using PHP includes (which in you mentioned you don't have the capacity for) although I can go into detail about using PHP includes if need be.
Alternatively just repeating the menu code in each html page is the only other option as far as I know.
I personlally don't know a way which is just done with a HTML and CSS. But there is an easy way with PHP.
You make a file (nav.php) where you put your navigation stuff into it.
(Don't forget the php tags):
Now you can include the file in any HTML Document:
<?php include_once "filePath"; ?>
With just html&css, I only know copy&pasting. But with your wording, it sounds like you want just one menu like menu.html and linking it onto the multiple pages where you if you were to change the menu, you only need to change it in one section and don't need to copy and paste the rest. Since you want 1 single menu and link it to the multiple pages, I suggest the php way as Lorenz mentioned.
http://www.w3schools.com/php/php_includes.asp
...or another way I saw someone else do it is somewhere in this video by DevTips:
https://www.youtube.com/watch?v=nZoUA-98fL4
its something like {% filename %} but idk what lang. or whatever that's suppose to be. He just made his code look so much messier to me that I didn't bother looking into it.

How to properly link to pages?

I have a sidebar with basic link that should appear on every page:
about
engage
contribute
If I go from main page and click on about link, how to go to engage from that page?
I have created multiple directories with .html files for every page. Right now I am using this method:
href="../../engage/engage.html"
but it gets complicated when making more pages and subdirectories.
Also, bonus question, is that a good way to organize webpages?
Thank you.
Well, I believe your problem is only happening because of your directory structure. I wouldn't use it, as I prefer a more navigational and hierarchical structure.
This may turn out to be a big mess as structure grows, but when it does, you shouldn't be using simple HTML.
If you have a lot of duplicated code in different HTML pages, you may want to use something else, such as PHP, to load your pages.
For example, if you use PHP, you make your index.php page load the duplicated code everytime, like headers, footers, toolbars, and the content page based on a path parameter (e.g. /index.php?page=engage.html). The good thing is: when you load pages that way, using the include('engage.html'), all the links in the pages you load refer to the relative path from index.
Any links to your other pages would look like this: href="index.php?page=about.html". With proper setup, it may even be cleaner: yourwebsite.com/?p=somedir/page.html.

Simple blog in CSS and HTML only

I have a simple html/css-only static website on which I would like to add a blog. Comments and RSS aren't necessary.
Now, how do I do that, without having to write all my entries in pure html?
My website consists of a vertical menu and an area to the right of it, where all the content goes on each page. I would like a blog inside that area on the blog page, so a blog on a separate page with its own layout is not what I'm looking for.
Googling this doesn't really help me much since the majority of the hits are on sites offering blog services.
Thanks in advance, I hope I'm not being too difficult. Please leave some feedback on my question if you think there are things I should have tried out before asking.
If i understand what you want the answer is that ist is not possible in pure html and css. With only Html and css you can not make a blog (if you dont want to edit the source everytime you write an entry and have to make a new file for each entry and so on).
You need some code (php or so) that is able to store and load the entrys into your site.
Html and css are not meant to make things working. With Html you define the elements so that they are structed and then with css you "style" your work. But for the task of a blog (i think you want an editor for the text on the site, the ability to edit, delete, more than one site and so on) you need something like php or aps.net that is able to "interact".

How to embed link HTML into CSS file for menus?

I know something like this is possible, I'm pretty sure I'm just wording it wrong as I've been searching online for hours to no avail.
The same way an HTML page refers to the CSS file for a menu design, how can the HTML page also refer to a file (or the same CSS file if possible) to get the links information? So when I change the link information in that one file, it changes links on all HTML pages referring to it. Is this possible?
There is no simple way to do this. In general this happens server-side and is drawn from a database.
You CAN draw this data from a JavaScript file, using HTML templating without having to depend on a server. This may help.
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-an-introduction-to-jquery-templating/

Direct page to other page

I am using HTML and would like to know why when I enter
<a class="button flip" href="index2.html">List View</a>
it tries to find the original_page_url#index2.html
thanks
Charlene
From that code that you've put it shouldn't be doing that which means something else on your page is doing that. Javascript is the most likely culprit since it can easily change where your link actually goes. There may be other ways this could happen but I'd look at your javascript.
If you post a full page repro of the problem that we can use to understand the problem better that would help a lot. Preferably cutting out all the superfluous stuff on your page so its not too big. ;-)
Without further information from you, the only three things I can think of that would cause that are:
1) Your href in your question is different than your actual source, and there is a # sign before the index2.html in the a link. However, I'll assume you gave the correct href code above, in which case...
2) Some javascript on the page is automatically making that link act as an internal page link and adding the # itself. Make sure you don't have any javascript on the page that might be doing that.
3) The server has a rewrite rule that affects your links and appends them with the # sign. That would be rather odd, however.