Replicate sidebar on all HTML pages

Asked

Viewed 168 times

0

I’m studying a code, and setting up a website with it. But, I made changes to the Dashboard sidebar, but they weren’t replicated to the other pages, I’d like when I changed the Dashboard, all the sidebars on the other pages to change as well. How can I do that?

Here’s part of the code:

https://pastebin.com/DwHT9Skw

I changed it this way on Dashboard: http://prntscr.com/j6p4tk

But when I go to another page, it continues the old way (in case I would have to change one by one, and I didn’t want to do that, I want when I change on Dashboard, go to all other pages): http://prntscr.com/j6p54d

  • All pages receive the same code?

  • Can be browser cache.

  • Yes, all pages receive the same code! So I would like Dashboard to be the "default" and just replicate to the next ones. Because the code I posted, it was the edited, I would like it to be automatic for the others;

  • Explain the question better. What changes have been made?

  • I changed the sidebar only in the Dashboard html. And every code is replicated to the other pages, in case I would have to change each manual, translate and etc. But it is already translated in Dashboard. I wanted the Dashboard sidebar to be the same for all the other pages, without me having to go on every page and paste the sidebar code into them

  • Do you use PHP? You would have to use include

  • Yes, I do, but I’m not new to the language either. Could you show me what the code would look like?

  • You can view the official doc. http://php.net/manual/en/function.include.php

  • Take a look at this answer that should help you. https://answall.com/questions/273072/carregar-html-de-other-html/273090#273090

Show 4 more comments

1 answer

0

From what I’ve seen you wear PHP on their pages.

Here’s what you can do

  1. Create a file php called sidebar.php
  2. Paste the sidebar code into that file
  3. Do require "sidebar.php"; where the sidebar on your site would be.

Therefore, any change you make to sidebar.php will also change on all pages as long as they all have the require

  • I use html on pages

  • Did not work http://prntscr.com/j824yk

  • From what I’ve seen you’re going to get the sidebar.html not the sidebar.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.