iFrame - JavaScript to delete elements - html

I have the following problem: We have two sites, one community page based on elgg and a second page based on typo3. What we want to do is create a simple iframe in a typo3 subpage, which contain the community page.
Since the community page has its own page header with logos etc, it looks stupid. I tried to delete everything expect the , but this is not possible because the iframe source looks like "http://myiFramePage.org", so they do not have the same origin.
Fortunately, the two systems are on the same server, but i was not able to create a relative url. Could you help me to find the right url?
/
public_html
elgg
index.php
typo3
index.php
Also i would like to ask what do you think? Does it make sence to cut out the body/most important parts of the page?

If you just cutout the body from elgg and call it inside typo, it wont work. Because its missing css, essential js files etc.
The best solution is to create a similar theme for the community site too. This will make both site looking the same and you wont loose any functionality of community site.

I don't like solutions which hack things, they have a tendency to break, and are virtually untestable. I would try to customize the internal page from within the system (as suggested in Webgalli's answer) to make it look like the outer page.

Related

How to embed another website into my own web to keep the same header

We have a web app that we want to integrate in the websites of several clients by a subdomain, since in most cases we cannot modify their webs. Besides, our web is build in a different language and we want to keep it in our servers.
At the moment, they are adding links on their site's menu to our subdomain, however, they want to keep the same header and the footer so that the user feels that they are on the same website.
For now, we are copying the html and inserting it in our template, but this is not a good solution for the future and we are having several problems due to javascript conflicts.
How can we solve this? An iframe does not allow us to modify its content, I think. Thanks in advance.
Don't know any good ways to do this client side.
First thought is to have all the pages link your Javascript to create the header/footer, but it's not good to require Javascript to display content.
HTML imports would really be perfect for this, but it not well supported. You can consider if you're willing to use a polyfill, like Google's webcomponents.
I feel like best approach here would be to do this somehow not on client side. Either use a server that lets you use a template engine, or some static site generator that supports templating.

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.

Common ways to target links?

Are iframes still widely in use today?
I am coding a site with divs, and I want everything to appear in the container div. Is it possible to do it without coding the header + nav into each page and have the content show at the exact same spot without using iframes?
I did a quick Google search and found a post that said it's not possible, but my site will have quite a bit of links.
As of right now, I am coding it with Tumblr, and the hashtags in the posts would act as links to a section of posts (Ex: #blog would retrieve every post under the "blog" link). What are some widely used ways to target links on a website?
If you are creating a multi-page website, it would be helpful to have the HTML content be generated dynamically or be built statically from template files. You don't want to manually update the same content across multiple HTML files.
Dynamic Pages
There are several options for dynamically generating HTML content depending on the software available to you. For example, PHP is a popular language for web development and is available through many web hosts.
Static Pages
It is possible to build static HTML documents from templates using something like Jekyll.
I'm not sure if I'm interpreting what you mean by "coding it with Tumblr" correctly or not, but I think you mean you're making a Tumblr site with their built-in HTML editing capability.
I think you'll have a very difficult time achieving the behavior you desire there. I think you're trying to create something resembling a single-page application. Tumblr probably just allows basic static HTML with little Javascript. The suggestion Kyle made about using PHP or something like that won't work because that code must be executed on a server, and Tumblr doesn't provide that capability to my knowledge.
If you really want this kind of functionality, you probably should get some paid web hosting and develop your web development skills. It's not a simple task, but it's fun!
Sorry if I underestimated you or anything. Just trying to read between the lines. It seems to me that you may be relatively new to web development given the content of your post, and I'm trying to nudge you in the right direction constructively.

Code headers and footers on each page or use the includes tag?

This is more a "best practice" question than it is a coding question. In regards to coding your header/navigation and footer sections in a website. Is it better to code it on each page or use the includes tag?
Coding it on each page seems very tedious and violates the golden rule of "never repeat yourself", so using the includes tag seems like the most obvious choice but I could be wrong.
I'm average at best when it comes to best standards in web design so I'm looking to get some input from the pro's so to speak.
Just as a side note, as far as I know you need some kind of "desktop server" in your development setup to use the includes tag, me working straight from my desktop then won't be able to test with the includes tag, is this correct?
Thanks in advance!
If your website is in PHP, then definitely use the include function for repeating content - not just the header/footer, but any repeating modules through the pages, too.
This means that any time you need to update your header, you don't need to do it separately on every page!
As for working locally - you can install PHP onto your computer, and have a local server environment to test with. If that seems daunting, then just upload to a test website before you upload to your live website, so you can use the PHP server there.
You shouldn't repeat code. Imagine that you have to change your header one day... you must need to make the change on all your pages! That's an absolute no-no.

Is it possible to create a web site header without copying and pasting it on every page?

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