Is there any other way to access one and the same menu without re-adding the code for it in each "page"?
I mean a menu looks exactly the same, no matter which part of the site you´re in.
So there should be a way to have that menu attached to every page on the site without adding the code for every page you create?
Which language you want to use for your site development?
There are lot of frameworks available for each language.
For example struts with tiles in java.
In tiles concept you will be defining some base layouts. which will specify header here sidebar here etc.
Then on next pages you can simply extend your new page into your base layout. There even if you are not specifying any content specifically, it will take previously defined one by default.
For example refer the struts tiles example link.
In jsp there is an option to add a page within an another page. Key word is
<%# include file='menu.jsp'%>
here menu.jsp is mu menu bar, which I am calling to a location in my page. So hat it it will appear in the place where I specified. If you are not comfortable with tiles concept, you can use this method for adding menu into your pages with out repeating entire codes in all pages.
There are a good number of ways to do this, and as far as I am concerned, they all use PHP or something similar to generate the HTML menu code on each individual page.
The browser must have all the content or it will not display a particular part. One can either hard code something like a menu into every html page or they could create something more of a php site which generates the html and serves it to the browser.
Other the writing the php yourself, off the shelf solutions will (often) allow you to do this. Examples would be shopping carts, as well as content management systems (CMS).
Related
a quick background. I have my website done using asp.net (webforms I believe) and it has default.aspx with sitemaster page (not mobile friendly). I have added html pages with separate css as well. (a) Except for main page default.aspx, all other pages are in html (it uses display: block, floats etc., but I am moving towards flex and grid in newer html pages to make it more mobile friendly but still I am constrained by default page though I could try to make that mobile friendly). However, I am left with page url extensions, mobile unfriendly site. Currently web.config is used for url redirection.
I thought of going fully with html/css/javascript if so how could I handle url redirection and removal url extensions? Or shall continue to use a mix of aspx and html pages as I currently have and update for responsiveness and eliminate url extensions using friendly urls nuget package. May be there is a better way. Appreciate your thoughts and input. Thank you
Sorry, how are you constrained by the default.aspx page? You should be able to use HTML classes and tags on it like anything else and render it responsively like the html pages. ~.aspx pages are just pages of HTML that allow code blocks and form controls on them that get processed by the server into html and AJAX (if there's a corresponding code behind file and the certain form controls are used). I'm not sure how it would be any different to make it responsive than any of the html files you have as well.
Regarding routing, what's the motivation for wanting to drop WebForms routing and url redirection? You can get around it with Javascript if you want, but at that point you don't even need WebForms or a backend if you're also trying to get rid of the default.aspx page. Does the site only serve static content and doesn't need a database or server logic at all?
Well, first of all, those asp.net pages and menus ARE bootstrap, and ARE responsive.
You seem to be under the impression that aspx pages and web forms are somehow LESS responsive then HTML pages or some other frame work.
That is NOT the case.
In other words some act of magic does not exist or occur by jumping to MVC pages, or HTML pages.
You get ZERO advantages.
Even for asp.net web forms, bootstrap “responsive” pages has been the default for more then 10 years now.
So, you see this as a web form page (aspx), and NOTE the menu bar:
Ok, lets make the page smaller. we get:
And if we go even smaller, then the menu bar colipases to the familiar "hamburger" like this:
And the same goes even for a standard say grid.
Say we drop in a grid like this:
Ok, lets shrink down to mobile - menu bar goes to hamburger, and we get this:
So, I am not convinced that simply going to HTML, or MVC pages will help much.
To get a nice responsive and re-sizing web page?
The aspx pages seem to work and do as good as job as most frameworks. And the efforts to get similar or even better results?
I don't see much difference. You might want to give a particular example, but aspx pages based on good old web forms seems to do as good as a job as most choices these days. Out of the box, the menu and pages are bootstrapped, and they are responsive.
It takes extra effort, and some talent to lay out such pages, and make them work well for any frame work if the same page is to be mobile friendly all the way up to say a large monitor on a desktop.
I open to adopting a newer framework works better, but those better results are that of the developer choosing to lay things out better - not that by just magic we drop the aspx page and you as a result get a better mobile experience.
I'm new at HTML and need to do a simple site as an assignment. For the site navigation menu I guess it would be easy to simply copy and paste the navigation menu HTML onto all the pages in a header div. But is there a better way to do this?
for example, is there an easy way (that doesn't require scripting) to only write the code in one place and have it included on every page? I remember that I did something in Dreamweaver that created a template page that included the navigation menu. However I have a feeling that that was just copying html between pages.
Without scripting your HTML files will need to contain the menubar in full.
You are describing what a server side scripting language can do. Without one - your HTML files are served as they are. Therefore they must contain the HTML for the menubar within them.
The comments mention using an iframe - though very creative - I believe it doesn't satisfy as being "a better way to do this"
You have must use HTML code every page without HTML does't work Try to learn some basic PHP it will help
I have made a couple of simple Joomla websites before. Those are using a custom template made by myself. They are easy websites as they have a simple linear menu, all pages have the same layout, just some articles are changing between pages.
But in my new project, I have a ready html website that I have to convert to Joomla. The problem is, there is no one repeating menu and there is no consistent layout. To simplify a bit: there are 10 pages and they all have different layouts. Between pages background changes, menu position changes, menu content changes, content box positions change, everything changes. This means I'm not able to do this site as I've done before, using one template index.php which simply contained my repeating page structure.
I am dreaming of a way to simply change ready_page1.html to ready_page1.php, adding some modules inside the php (which are then available for online editing, which is the reason switching to Joomla). I would do this to each page. The custom menus inside each page I would "manually" point to the according php files instead of the old html files. Is this method possible somehow? I couldn't figure out how to do this.
I don't care loosing lots of Joomla basic functionality due to this crude method, I just want the simplest way to do this.
In the end, I just want the exact same website I already have on html, but I want some chosen rectangular areas in the html pages to be editable Joomla modules. The modules would have the pen icon for editing. That's it, no other functionality is necessary.
Sounds like the site you are converting is a usability nightmare. Consistency is part of giving the user a positive experience. That said, if you have to make it exactly the same, then the easiest way is to do it the right way to begin with.
First, you need to learn about page class suffixes. You can add those to a menu item so that you can control the CSS on a per page basis. This will allow you to change backgrounds and other elements on each page.
Documentation - http://docs.joomla.org/Page_Class_Suffix
Next, you will need to make a template so that each of the module positions is collapsible. If you plan out the positions, you should be able to use a single index.php for the entire site. We have a custom template that we use for every site we do and it rarely needs to be touched because all of the positions we would possibly want to use are already there, they just don't get used until a module is put in the position.
Documentation - http://docs.joomla.org/Collapsing_columns
You will also want to make sure you understand menu assignments. You should be able to assign the modules to the pages as needed to create the layout you want for each page. If you are using 2.5.x, then you can probably get by with the built in menu assignment features. If you are using 1.5.x then (you really should upgrade) you will probably want to use Advanced Module Manager as it makes menu assignments much easier and more flexible.
Documentation - http://docs.joomla.org/Help15:Screen.modules.edit.15#Menu_Assignment
Once you get a good grasp of how Joomla templates work and how they are supposed to be used you will find that you can basically do anything you want within the framework so you don't lose any functionality.
build your website and create those 10 pages (contents, heirarcy, and so on..).
then create your templates based on those html files. this is where you adapt the html into a joomla template. after this step, you should end up with at most 10 templates depending on your styles (crude but quick)
as far as i know and from the documentation, Joomla 1.7 supports "template per page" (see the screenshot). you can pick out which style will be applied to which item. it even applies to subpages. another documentation here
Hi I want to create a website which has the following structure:
The idea is to have a menu in the left and border images in the left and right frames. the header will contain the page title and also user information (i.e. logged in, log out button etc). The content region is the one where the site content is displayed. I want to only update this as buttons are pressed in the menu in the left frame...
How can I achieve this using iframes? Sorry I am a HTML noob.... Are frames the best approach? I just want to have a part of the page that updates as opposed to the entire page redrawing each time..
Actually frames are NOT a good approach. You should avoid frames and completely forget about their existence if possible. Frames are evil.
Better approach is use of a preprocessor (PHP, ASP, Python,..) to include parts of the page into HTML. There are many frameworks and templating systems which will do the hard work for you. E.g. for PHP see Smarty temlating engine.
If you don't want browsers to reload all page but only content in the middle of the page AJAX is much better solution.
Update:
In jQuery you could use jQuery.click() and jQuery.load() functions to load and place new content into page when a user clicks on a menu item.
Best practice when using ajax to load new content dynamically is to provide also alternative for machines with disabled JavaScript (e.g. search engines crawlers). However it's bit more complicated to implement this properly from a scratch, but there are some frameworks which can help you. Personally I prefer Nette Framework because it's lightweight and efficient in comparison to other frameworks.
I'm building a small-scale website (a personal one) in which each page would have the same set of header elements (I'm not talking about the <head> element). In other words, I want each page to have essentially the same title at the top of the page and the same navigation bar below that (with possibly minor differences in each page). It's kind of like how StackOverflow has that navigation bar (with the logo, and the Questions, Tags, etc. buttons) on the top of every page.
Is it possible create such a header for every web page without copying and pasting the HTML code to do so? I really don't want to run into a situation where if I want to make a single change, I would have to change all of my pages containing the header.
Real web sites use real web frameworks, which have a concept called a "layout" (at least that's what they're called in Rails; as mentioned in Uwe's answer, they're called master pages in ASP.NET). All the common "templatey" stuff goes into a layout.
How about include files in a server-side language like PHP or master pages in ASP.NET?
You need to use some kind of dynamic page processing, whether it's PHP, a server-side include, or a similar tool.
If you need to stick with straight HTML, you could try to rig something up with AJAX or JavaScript - but then you highly limiting your website's functionality, giving it serious performance issues, AND preventing users who have JavaScript disabled from using your website.
A third answer is to use some sort of pre-deployment tool. This used to be a bigger market, but I think it's mostly dried up now. Here's an example for using DreamWeaver to handle this.
If you have a PHP server that supports PHP,
<?php include 'header_inc.php'; ?>
If that's not available
<!--#include virtual="header_inc.html" -->
But whether this works or not is server dependent
If you have a server with PHP capabilities
include 'header.inc.php';
you must put the header code in a file named that and then put that include code in all pages that you want the header to show up on