문제

Would it be possible for me to make edits on a particular item that is on all page on my website and have it be edited on all pages.

For example, if I had a sidebar on all pages of my website, and I wanted to change the announcements box within that sidebar to a new announcement, could I do so without having to make the changes on all pages? How would I be able to if so?

도움이 되었습니까?

해결책

What you're looking for is an iframe, you'll find tons of tutorials about that, but here's a quick example:

In your page e.g. index.html:

<html>
<head>
</head>
<body>
    <div id="sidebar">
        <iframe width="100" height="500" src="sidebar.html"></iframe>
    </div>
    <div>
        Your main page content
    </div>
</body>
</html>

In your sidebar.html:

<html>
<head>
</head>
<body>
    <div>
        Sidebar content goes here...
    </div>
</body>
</html>

Now anything you update on the sidebar.html will be updated on index.html.

Add this iframe to every page that you want to contain this sidebar.

Hope this helps...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top