How do sites quickly make updates to thousands of pages with user created content without affecting the old content. I know you can do it in php resulting in urls such as .../profile.php?id=000000000&ref=nf such as facebook does. I don't know php but maybe there is a way to get the same effect without affecting the url (witch is my goal). Digg.com is another site that i saw go through an update, updating all old pages as well and there urls don't look like that. At first I thought it was all done through css but I don't think some of that changes they made are possible through pure css. If you can help me in any way learning how to build this capability that would be great. thanks

Dani AI

Generated

Short version: keep layout code out of each content page and load it from one place. That way you can swap or update the layout for every URL without touching the content files themselves.

There are three practical patterns to do this depending on how your site is built:

  • Dynamic (recommended for user-generated sites): store content in a database and render pages from templates/partials (header, nav, footer). Changing one partial updates every page that includes it. In PHP, that is usually done with include/require (for example <?php include __DIR__ . "/partials/header.php"; ?>) — see the PHP manual for details (include). Use a theme folder or a config variable so you can flip entire layouts quickly.

  • Static-but-server-processed: use Server Side Includes or your webserver's include mechanism so common bits are inserted at request time (Apache mod_include is one option: mod_include). CDNs with ESI can do similar work at the edge.

  • Existing flat HTML files: avoid manual edits. Script the change with an HTML-aware tool (not plain regex). A small Python script using BeautifulSoup can find and replace the nav element across thousands of files safely — back up first and test on a subset (BeautifulSoup docs).

Notes and gotchas: CSS can change presentation but not add semantic links or new markup (so it cannot add menu items by itself — see and ). Client-side injection (as suggested) works, but remember SEO, accessibility, and users without JavaScript. Always stage changes, purge caches/CDN after deployment, and keep a rollback plan.

Recommended Answers

All 8 Replies

They use one common external style sheet for all of their web pages. All they have to do is change the style sheet, and the whole look of the site changes.

I agree with midimagic that the proper way is to use a external css file and then import the css. In this way if you change single external css file than the whole look of the site gets changed.

How do they add a new menu item through css?

Have one page with the menu on it, and put links to that page in all the other pages.

Or edit each page separately to add the item.

I'm saying they added new menu items to thousands of pages quickly. The changes were seen on every page. Are you saying the code for the menu was imported from another file? There is no way they edited each page.

In sites I design, I create my menus using javascript. By changing one file, the menu is updated on every page that calls the script.

Cool thanks, thats one way I look into.

Something else I just thought of is there anyway to batch edit html files?

Another possibility is that they edited the files offline, and then uploaded them nearly simultaneously.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.