简体   繁体   English

更新多个页面

[英]Update multiple pages

I am doing some freelance work for a client and I need to re-code an old menu. 我正在为客户做一些自由职业,我需要重新编码旧菜单。 The entire site is static which will make this process extremely slow and redundant, does anyone have a good technique for updating multiple pages automatically? 整个站点都是静态的,这将使该过程极其缓慢且冗长,有人能自动更新多个页面吗?

The old developer used "Allwebmenus" which is a automatic menu creation tool. 旧的开发人员使用“ Allwebmenus”,这是一个自动菜单创建工具。 It is implemented by using JavaScript which writes HTML to the DOM. 它是通过使用JavaScript将HTML写入DOM来实现的。 I'm going to replace this with a clean html menu and some simple jQuery. 我将用干净的html菜单和一些简单的jQuery替换它。

Right now I think the best way is to create a separate .html file with the menu code, and use PHP includes on all the pages but this still requires me to update every page on the site. 现在,我认为最好的方法是使用菜单代码创建一个单独的.html文件,并在所有页面上使用PHP包含,但这仍然需要我更新站点上的每个页面。 Can anyone give me better idea? 谁能给我更好的主意? Or do you think this is the best option? 还是您认为这是最佳选择?

Thanks for the help! 谢谢您的帮助!

create menu.php and include("menu.php") into each file where the old menu's are written. 创建menu.php并将include(“ menu.php”)放入写入旧菜单的每个文件中。 It will make your life easier going forward too. 这也将使您的生活更轻松。

As far as fixing all the static pages, you will have to go in and do that yourself. 至于修复所有静态页面,您将必须自己进行操作。

include("menu.html");

You can use includes, but it might also make since to put them onto a CMS like Drupal. 您可以使用include,但由于将它们放到Drupal之类的CMS上也可以这样做。 Handles a lot of that for you. 为您处理很多。

Using the PHP includes is a good method. 使用PHP include是一个好方法。 If the "Allwebmenus" has Javascript code on each page, you'll have to edit each file anyways, so adding the includes is no big deal. 如果“ Allwebmenus”的每个页面上都有Javascript代码,则无论如何都必须编辑每个文件,因此添加包含内容没什么大不了的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM