Same content on many different Websites
I have to create a website and on every page I have a top nav bar. Acctualy I have 10 sites and when I have to change the content of the NavBar, I have to change it in every single site.
What is here best practice?
I have tryed to create a js file with the NavBar inside (document.write"".....), but with this solution I have to convert the html code into JS code and this is not my favorite solution?
Is there an better way?
Thanks for answer.
javascript html
add a comment |
I have to create a website and on every page I have a top nav bar. Acctualy I have 10 sites and when I have to change the content of the NavBar, I have to change it in every single site.
What is here best practice?
I have tryed to create a js file with the NavBar inside (document.write"".....), but with this solution I have to convert the html code into JS code and this is not my favorite solution?
Is there an better way?
Thanks for answer.
javascript html
2
I think usingphp
to do this and then usingreadfile
orinclude
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript
– Nick Parsons
Nov 23 '18 at 7:57
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29
add a comment |
I have to create a website and on every page I have a top nav bar. Acctualy I have 10 sites and when I have to change the content of the NavBar, I have to change it in every single site.
What is here best practice?
I have tryed to create a js file with the NavBar inside (document.write"".....), but with this solution I have to convert the html code into JS code and this is not my favorite solution?
Is there an better way?
Thanks for answer.
javascript html
I have to create a website and on every page I have a top nav bar. Acctualy I have 10 sites and when I have to change the content of the NavBar, I have to change it in every single site.
What is here best practice?
I have tryed to create a js file with the NavBar inside (document.write"".....), but with this solution I have to convert the html code into JS code and this is not my favorite solution?
Is there an better way?
Thanks for answer.
javascript html
javascript html
asked Nov 23 '18 at 7:55
rayigen85rayigen85
62
62
2
I think usingphp
to do this and then usingreadfile
orinclude
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript
– Nick Parsons
Nov 23 '18 at 7:57
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29
add a comment |
2
I think usingphp
to do this and then usingreadfile
orinclude
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript
– Nick Parsons
Nov 23 '18 at 7:57
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29
2
2
I think using
php
to do this and then using readfile
or include
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript– Nick Parsons
Nov 23 '18 at 7:57
I think using
php
to do this and then using readfile
or include
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript– Nick Parsons
Nov 23 '18 at 7:57
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29
add a comment |
2 Answers
2
active
oldest
votes
I think you should create a navbar.html file, contain the code of your nav bar, then
<?php
include 'navbar.html';
?>
add a comment |
First you can use media in css ,
The @media rule is used in media queries to apply different styles for different media types/devices.
In my words, you can give different style based on screen's width.
The Second method is The Browser Object Model.
BOM, screen.width can return you the width of the current browswer's width.
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442649%2fsame-content-on-many-different-websites%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you should create a navbar.html file, contain the code of your nav bar, then
<?php
include 'navbar.html';
?>
add a comment |
I think you should create a navbar.html file, contain the code of your nav bar, then
<?php
include 'navbar.html';
?>
add a comment |
I think you should create a navbar.html file, contain the code of your nav bar, then
<?php
include 'navbar.html';
?>
I think you should create a navbar.html file, contain the code of your nav bar, then
<?php
include 'navbar.html';
?>
answered Nov 23 '18 at 8:19
Bálint CséfalvayBálint Cséfalvay
649
649
add a comment |
add a comment |
First you can use media in css ,
The @media rule is used in media queries to apply different styles for different media types/devices.
In my words, you can give different style based on screen's width.
The Second method is The Browser Object Model.
BOM, screen.width can return you the width of the current browswer's width.
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
add a comment |
First you can use media in css ,
The @media rule is used in media queries to apply different styles for different media types/devices.
In my words, you can give different style based on screen's width.
The Second method is The Browser Object Model.
BOM, screen.width can return you the width of the current browswer's width.
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
add a comment |
First you can use media in css ,
The @media rule is used in media queries to apply different styles for different media types/devices.
In my words, you can give different style based on screen's width.
The Second method is The Browser Object Model.
BOM, screen.width can return you the width of the current browswer's width.
First you can use media in css ,
The @media rule is used in media queries to apply different styles for different media types/devices.
In my words, you can give different style based on screen's width.
The Second method is The Browser Object Model.
BOM, screen.width can return you the width of the current browswer's width.
answered Nov 23 '18 at 8:26
raymondlukerraymondluker
1
1
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
add a comment |
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
@media only screen and (max-width: 600px) { body { background-color: lightblue; } }
– raymondluker
Nov 23 '18 at 8:27
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
I'm afraid this question is not about applying styles for different screens
– barbsan
Nov 23 '18 at 9:01
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
ok. so is this about same nav bar in different URL?
– raymondluker
Nov 26 '18 at 9:35
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442649%2fsame-content-on-many-different-websites%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
I think using
php
to do this and then usingreadfile
orinclude
is the easiest way to go about doing this. Or you can use the methods founds here if you wish to stick with javascript– Nick Parsons
Nov 23 '18 at 7:57
You've different websites or different pages of the same website?
– Cristian Traìna
Nov 23 '18 at 8:22
I have different pages on the same website ;-)
– rayigen85
Nov 23 '18 at 8:29