• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

which file to edit for site wide effect

GeorgeB

Chairman/CEO TMCG
NLC
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?
 
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?
 
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.
 
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.
 
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.
 
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?
 
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.
 
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.
 
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 ";"
 
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"); ?>
 
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.
 
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?
 
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 &copy; Try that and it should work out for you.
 
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.
 
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 &copy, just the circle with the c in it.
 
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.
 
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.

PHP:
<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.

PHP:
<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>
 
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.
 
Back
Top