Wizard Posted May 22, 2010 Posted May 22, 2010 Learn MySQL and PHP. http://www.freewebmasterhelp.com/tutorials/phpmysql
Byron Posted May 22, 2010 Posted May 22, 2010 The best way to do what you want is to make one header page and one main menu page and use php includes on ALL your pages. Then on ALL of your pages you would include your header page and your main menu page (where you wanted it to show) like this: <?php include("files/header.html"); ?> <?php include("files/main_menu.html"); ?> Then all you have to do is edit one header page and one footer page to change them all. Keep in mind that all of your pages need to be php pages to use a php include. Of course if they are html pages you can use htaccess to cause html pages to be parsed as php pages without having to change the extension from html to php. EDIT: Here's a couple of tutorials. You can find many more about php includes at Google. http://www.tizag.com/phpT/include.php http://www.w3schools.com/PHP/php_includes.asp If you need help to make you html pages act as php let me know.
Wizard Posted May 22, 2010 Posted May 22, 2010 Thanks Wizard, I have this last question: Do I need a special program on My computer to develop “mysql” (like HTML editor for HTML pages) (also the same question for "myphpadmin")? My second question is: since You are a professional (in this domain), do You think that learning “mysql” needs a professional (and takes very very long time) or it is like HTML that You can learn it without any problem (and You can learn it in few months and without any need of professional teaching)? Its best for a beginner, in my opinion, to just use an online hosting server (like ours) which already has MySQL and PHP configured. If you read the link from my first post, it does tell you a little bit about installing the software on your own computer though, but that's unnecessary for your first time developing in MySQL+PHP. In other words, just code your PHP files in notepad.exe or something and then upload it as if you were editing your html files. You'll have no problems learning MySQL and PHP by yourself (without the help of a "professional") if you put your mind to it. Follow the tutorials that Bryon and I have posted here. @Bryon: That's a lame hack. If he learned MySQL+PHP, he would only have one file to edit ever+a MySQL database. Way easier IMO than fixing 200+ pages with include. Then again, it does do exactly what he requested, though what he requested still takes a ton of work to maintain. @Tony M: What's your website anyways?
Byron Posted May 22, 2010 Posted May 22, 2010 @Bryon: That's a lame hack. If he learned MySQL+PHP, he would only have one file to edit ever+a MySQL database. Way easier IMO than fixing 200+ pages with include. Then again, it does do exactly what he requested, though what he requested still takes a ton of work to maintain. No not really a hack. It's the correct way to do a header and a footer for a website (that doesn't use MySql). That way you only edit the header or footer page to change 200 pages. It may be better for him to use MySql to change 200 pages, but since I'm not familiar with MySql I can't say. Some day I intend to learn.
Wizard Posted May 22, 2010 Posted May 22, 2010 @Bryon: That's a lame hack. If he learned MySQL+PHP, he would only have one file to edit ever+a MySQL database. Way easier IMO than fixing 200+ pages with include. Then again, it does do exactly what he requested, though what he requested still takes a ton of work to maintain. No not really a hack. It's the correct way to do a header and a footer for a website (that doesn't use MySql). That way you only edit the header or footer page to change 200 pages. It may be better for him to use MySql to change 200 pages, but since I'm not familiar with MySql I can't say. Some day I intend to learn. hack 1. /n./ Originally, a quick job that produces what is needed, but not well. 2. /n./ An incredibly good, and perhaps very time-consuming, piece of work that produces exactly what is needed.
Byron Posted May 22, 2010 Posted May 22, 2010 Your definition isn't defining the php include function. The php include function is not a hack, it is the correct way to add a header, menu, or footer on several php pages so that editing only one page changes all pages. http://php.net/manual/en/function.include.php This wouldn't be a time consuming task if he would have set his pages up at first using the include function. It's going to be time consuming no matter what he does to correct it. I don't know mysql but i really don't think just one page is going to correct his problem. Also learning php and mysql isn't something you can learn overnite and I'm sure he would like to correct his pages before learning them.
Tony M Posted May 22, 2010 Author Posted May 22, 2010 Thank You (Bryon, Wizard) for Your posts and links for Tutorials , I have read Your posts links and searched "Google". But Now I had a problem, all My pages are HTML and I want to make them PHP . Ok, if I rename all My .html files to .php files do they work or I have to re-edit all My page to .php format (like using http://www.yellowpipe.com/yis/tools/HTML_c...ter/index.html)?
Byron Posted May 22, 2010 Posted May 22, 2010 Ok, if I rename all My .html files to .php files do they work or I have to re-edit all My page to .php format (like using http://www.yellowpipe.com/yis/tools/HTML_c...ter/index.html)? No you won't have to do any editing for your html pages to work as they did before. You will however be able to use php on your pages which will give you greater flexability.
Tony M Posted May 22, 2010 Author Posted May 22, 2010 Ok, if I rename all My .html files to .php files do they work or I have to re-edit all My page to .php format (like using http://www.yellowpipe.com/yis/tools/HTML_c...ter/index.html)? No you won't have to do any editing for your html pages to work as they did before. You will however be able to use php on your pages which will give you greater flexability. Ok, Do You mean that I will let (left) all My pages .html and only add the PHP code that You tell Me above (and they work like .php files)?
Byron Posted May 22, 2010 Posted May 22, 2010 Ok, Do You mean that I will let (left) all My pages .html and only add the PHP code that You tell Me above (and they work like .php files)? No you'll have to change the extension to .php for the php code to work, but you won't have to change anything about the html inside the pages. There is another way (which may be considered more of a hack) and that's to use htaccess to make your html pages act like php. That would keep you from changing 200 pages to a .php extension. Would you rather use the htaccess and not change the extensions?
Tony M Posted May 22, 2010 Author Posted May 22, 2010 Ok, Do You mean that I will let (left) all My pages .html and only add the PHP code that You tell Me above (and they work like .php files)? No you'll have to change the extension to .php for the php code to work, but you won't have to change anything about the html inside the pages. There is another way (which may be considered more of a hack) and that's to use htaccess to make your html pages act like php. That would keep you from changing 200 pages to a .php extension. Would you rather use the htaccess and not change the extensions? Ok, if I change the extension to .php , "Google" might find that My pages are duplicate (and ban My website), because "Google" indexed My website when he was .html (all files ended with .html) and now he finds new pages who are the same but ends with .php . Ok, I think it is preferably to configure .htaccess to make html files to be php?
Byron Posted May 22, 2010 Posted May 22, 2010 Ok, I think it is preferably to configure .htaccess to make html files to be php? OK then add this line of code inside your public_html .htacess file: AddHandler application/x-httpd-php5 .html .htm That will cause all of your html files to be parsed as php files, which will allow you to use php code inside your html files.
Tony M Posted May 22, 2010 Author Posted May 22, 2010 Ok, I think it is preferably to configure .htaccess to make html files to be php? OK then add this line of code inside your public_html .htacess file: AddHandler application/x-httpd-php5 .html .htm That will cause all of your html files to be parsed as php files, which will allow you to use php code inside your html files. Ok, I searched "Google" and find that there is a way to redirect (301) pages of .html to .php using .htaccess ( http://www.isitebuild.com/301-redirect.htm ), do this work? (If Yes, I think I would change all My files extension to .php and use this .htaccess code) RewriteEngine on RewriteBase / RewriteRule (.*).html$ /$1.php
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now