开发者

how to edit website sidebar and have change effect entire site

开发者 https://www.devze.com 2023-01-06 04:49 出处:网络
I am designing a website in Dreamweaver with a sidebar that will be present on every page. I would like to know how to I set up my sidebar so that when I make changes to it I don\'t have to edit the c

I am designing a website in Dreamweaver with a sidebar that will be present on every page. I would like to know how to I set up my sidebar so that when I make changes to it I don't have to edit the code on ev开发者_如何学Goery page


A server-side solution (as per sAc) is what would work best for you. But you could also do this by loading the sidebar from the server with JavaScript/jQuery and AJAX. It's not a great solution, but it could work if you're not using a server-side language.


You will have to create an include file for your side bar that will contain only your sidebar code. Once you have put your code in a separate page/file for your sidebar you can include it with server-side includes.

Here is an example of how it could be included with php:

include ('includes/sidebar.php');

Now, if you make any change to your sidebar include file, it will be reflected to all the pages of your side where you have included this file.

Note: I assume you are using some server-side language otherwise for static site, you might consider jquery load method for example but again this is not that good in case JavaScript is disabled.

0

精彩评论

暂无评论...
验证码 换一张
取 消