View Full Version : which file to edit for site wide effect
GeorgeB
November 25th, 2011, 17:46
I am wanting to make a change in my websites code, to add a toolbar at the bottom of all the pages, that shows up globally. Is there an easier way then to edit each single file, so I just edit one, and it shows up site wide?
wswd
November 25th, 2011, 18:03
You still have to edit each page to put a line of PHP code or such at the bottom to point to the page with the toolbar, but once you have that done, you will only need to modify the page with the toolbar and it will change sitewide.
Is that what you're looking to do?
GeorgeB
November 25th, 2011, 21:53
You still have to edit each page to put a line of PHP code or such at the bottom to point to the page with the toolbar, but once you have that done, you will only need to modify the page with the toolbar and it will change sitewide.
Is that what you're looking to do?
That is a bit confusing..
If I am having to edit each and every page to include the code for the toolbar to show up, then, if I ever updated or modified it, wouldn't I have to re do each and every page again?
I dont see how doing it once is one thing, but after that, just 1 file needs to be edited.
Sain Cai
November 25th, 2011, 23:23
Probably not. Take Wordpress for example. You can change the header php file and it will change globally.
Perhaps the website in question posted would help people more.
wswd
November 25th, 2011, 23:50
That is a bit confusing..
If I am having to edit each and every page to include the code for the toolbar to show up, then, if I ever updated or modified it, wouldn't I have to re do each and every page again?
I dont see how doing it once is one thing, but after that, just 1 file needs to be edited.
You want to use PHP includes, assuming your sites are in PHP. No, if you do it properly, as long as the include code is on each page, you should never have to modify it again. You would just modify the page with the toolbar.
Here's an example.
index.php is your main page.
mysiteisawesome.php is the second page.
toolbar.php is the page that contains the code for the toolbar.
On your index.php and mysiteisawesome.php pages, you will use a PHP include (one short line of code) to include the toolbar.php page automatically at the bottom of those two pages. If you ever need to modify the toolbar/footer, you would simply modify toolbar.php and it would be updated automatically in every single page, whether it's 2 pages like in my example, or 2000 pages.
Visit my website, www.wswd.net
See all the links at the bottom, the copyright at the bottom, etc.? That shows up on every single page of the site. There is one page that controls all of that, we'll call it footer.php for simplicity sake. When I need to modify one of those links, or even when I change the copyright from 2011 to 2012 in a couple months, I only edit the footer.php page to reflect the changes, and all the other changes are updated automatically.
GeorgeB
November 26th, 2011, 08:14
You want to use PHP includes, assuming your sites are in PHP. No, if you do it properly, as long as the include code is on each page, you should never have to modify it again. You would just modify the page with the toolbar.
Here's an example.
index.php is your main page.
mysiteisawesome.php is the second page.
toolbar.php is the page that contains the code for the toolbar.
On your index.php and mysiteisawesome.php pages, you will use a PHP include (one short line of code) to include the toolbar.php page automatically at the bottom of those two pages. If you ever need to modify the toolbar/footer, you would simply modify toolbar.php and it would be updated automatically in every single page, whether it's 2 pages like in my example, or 2000 pages.
Visit my website, www.wswd.net
See all the links at the bottom, the copyright at the bottom, etc.? That shows up on every single page of the site. There is one page that controls all of that, we'll call it footer.php for simplicity sake. When I need to modify one of those links, or even when I change the copyright from 2011 to 2012 in a couple months, I only edit the footer.php page to reflect the changes, and all the other changes are updated automatically.
Yes, the sites are in PHP.
I am following you so far, on creating the toolbar.php, and also think you on the other examples as well.
Now, the question is: What is PHP Includes...I am guessing it would be code of some sort, so, where would I get it from? This code, has to be placed into the bottom of each page?
wswd
November 26th, 2011, 13:39
Here's a good start with examples: http://www.w3schools.com/PHP/php_includes.asp
You need to put the include where you want the toolbar to appear.
GeorgeB
November 26th, 2011, 15:09
Here's a good start with examples: http://www.w3schools.com/PHP/php_includes.asp
You need to put the include where you want the toolbar to appear.
Thanks a lot. I get the idea on what to do now.
Also, where would you place the php include html code? Would it be just right before the </Body> in each file?
Also, since I have never done this, what would be a good, easy to use program for editing php files?
Normally, I just open them either in wordpad or notepad, which has been effective.
wswd
November 26th, 2011, 15:25
Wordpad or Notepad is just fine for PHP.
You need to put the php include right where you want that page to appear. For example, if you want it right at the bottom of the page, yes, right before /Body might be the best place for it. Just depends on what your page looks like really. Without seeing the exact page and code, it's difficult to say.
GeorgeB
November 26th, 2011, 16:23
Wordpad or Notepad is just fine for PHP.
You need to put the php include right where you want that page to appear. For example, if you want it right at the bottom of the page, yes, right before /Body might be the best place for it. Just depends on what your page looks like really. Without seeing the exact page and code, it's difficult to say.
Thanks man.
One last question. If I need to do it for 2 different files like "footer.php" and "toolbar.php", would I do the phpinclude code twice, or is there a slight trick to enter more than 1 page name, like a "," or ";"
wswd
November 26th, 2011, 16:32
You're welcome.
As far as I remember, you should be able to do it twice, just one line after the other.
<?php include("toolbar.php"); ?>
<?php include("footer.php"); ?>
GeorgeB
November 26th, 2011, 16:51
I am working on my footer.php file right now.
However, the © isn't wanting to show correctly. It shows a diamond with a ? inside of it.
GeorgeB
November 26th, 2011, 22:14
Well, this is interesting. I did this, and for the footer, it is working nicely in firefox and IE. However, for http://viprecycling.com, it is working in firefox, but messed up in IE.
The footer part looks fine, but the one for the toolbar, is real messed up. Any ideas, why that is in IE?
wswd
November 27th, 2011, 03:27
Yikes! Definitely messed up in IE. I'd say it's the actual toolbar itself that's incompatible with IE. When you just look at the toolbar (i.e. toolbar.php, or wherever the code is) in IE, is it still messed up?
The HTML code for the copyright is © Try that and it should work out for you.
GeorgeB
November 27th, 2011, 09:52
Yikes! Definitely messed up in IE. I'd say it's the actual toolbar itself that's incompatible with IE. When you just look at the toolbar (i.e. toolbar.php, or wherever the code is) in IE, is it still messed up?
The HTML code for the copyright is © Try that and it should work out for you.
I navigated to http://viprecycling.com/toolbar.php in IE, and it is messed up for sure. I guess like you said, that it is incompatible with IE, so I will contact their support department and maybe there is a fix for it that they haven't updated or something.
I will also try the thing for the copyright...thanks.
GeorgeB
November 27th, 2011, 09:56
The HTML code for the copyright is © Try that and it should work out for you.
That worked..I have a msword file with several constantly used html codes, and for that one, I didn't have the code for the ©, just the circle with the c in it.
GeorgeB
November 27th, 2011, 10:40
Not, I am not sure if it is incompatible with IE, as the other site I installed the toolbar on, is working fine in IE. http://forums.millenniumcapitalcorp.com - if you go here, you can see the toolbar shows fine in IE.
wswd
November 27th, 2011, 12:49
Well that's weird. But if the toolbar page itself is still broken, there has to be something wrong with the toolbar code. Perhaps you are using it differently? There's something different from one to the next. I would copy the code directly from the working IE site to the toolbar page, try it like that, and see if it works. If it does, then go back to modifying it for the new site and see what breaks.
GeorgeB
November 27th, 2011, 13:36
Well that's weird. But if the toolbar page itself is still broken, there has to be something wrong with the toolbar code. Perhaps you are using it differently? There's something different from one to the next. I would copy the code directly from the working IE site to the toolbar page, try it like that, and see if it works. If it does, then go back to modifying it for the new site and see what breaks.
Here is the code that I have on my forums, that works fine in all the browsers.
<script src="http://cdn.wibiya.com/Toolbars/dir_1056/Toolbar_1056385/Loader_1056385.js" type="text/javascript"></script><noscript><a href="http://www.wibiya.com/">Web Toolbar by Wibiya</a></noscript>
Here is the code for the vip recycling site that works find in firefox and chrome, but not IE.
<script src="http://cdn.wibiya.com/Toolbars/dir_1056/Toolbar_1056599/Loader_1056599.js" type="text/javascript"></script><noscript><a href="http://www.wibiya.com/">Web Toolbar by Wibiya</a></noscript>
wswd
November 28th, 2011, 00:57
Heh...that's a very good question. Possibly something else breaking the code then. Wouldn't know where to start.
Try putting the 1st toolbar in the recycling site and see if it breaks it.
GeorgeB
November 28th, 2011, 08:43
Heh...that's a very good question. Possibly something else breaking the code then. Wouldn't know where to start.
Try putting the 1st toolbar in the recycling site and see if it breaks it.
I took the code from my forums, and replace it with the recycling site. It is still all messed up in IE. So not too sure what is wrong.
I switched it back. Perhaps, vbulletin's code has something to it, that makes it appear correctly in IE.
wswd
November 28th, 2011, 20:14
Could definitely be vBulletin code, or any other code on the page for that matter. To track it down, just take certain elements completely out of the page until it works. You should then have a pretty good idea of what is breaking the code.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.