Mr. B Posted February 3, 2007 Share Posted February 3, 2007 Well, I was told to instal php 5.0, then told, I need apache. Then after many studies and research I found out I need a web server. So, I hop onto yahoo, typed free web host. then Boom...I'm in there right, control panel baby. So I decide to just make a copy script from the introduction pages of a book. Just to see, explore, and poke around a little bit. It was mixed with html and basic variable settin with names given to them. So my question here is really...What file name do I have to upload the text with? Due to the nature of the .html and .php not coming out correct when you visit the actual site. Now, how ever I uploaded the files through the file manager that the control panel gaved me access to. May be perhaps it needs to be done through ftp. I do not know, thats why I'm here. Besides that, I understand that the web host I have may not be php compatatible. Now, is that the answers to my problems? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 3, 2007 Share Posted February 3, 2007 When you type in PHP what is the output? I would definitely figure out if you have PHP compatability before going on though...that is likely the reason if you are using a free host and didn't check and see first. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 3, 2007 Author Share Posted February 3, 2007 HAHA I'm such a dummy, thank you for your time. I hope you help me again, because trust me. I'll be around... maybe you know a couple of free web host with php? Quote Link to comment Share on other sites More sharing options...
chronister Posted February 3, 2007 Share Posted February 3, 2007 If you are just testing stuff out to learn download and install an all in one apache/php/mysql program like XAMPP or WAMP http://www.apachefriends.org/en/xampp.html http://www.wampserver.com/en/ These are all in one installations of apache(webserver), PHP, MySql (database). You can install this on your home computer and then you have a webserver right there. You don't have to worry about uploading or hassle with ads that are probably on the free host. Plus by having your own testing server that you run, you can have your own sub-domains I have tried a bunch of free hosts and I thought they were all junk. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 3, 2007 Author Share Posted February 3, 2007 Thanks, I'll take the advice under heavy consideration. As a matter of fact, I'm downloading the file as I type. But I can't just help and notice the time, so I must continue on tomorrow. I'll ask anything else as they arrive. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 4, 2007 Author Share Posted February 4, 2007 Hey pocobueno. I was wondering if you please listen once again. Same problem, I switched up my host. I got paid hosting and all that. http://s195914084.onlinehome.us/ When you enter the site, you'll see my problem. The source code has everything. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 4, 2007 Share Posted February 4, 2007 Could you show me the code? Someone else was having the problem the other day as well...not sure how that ended up. I will see if I can find the post. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 4, 2007 Author Share Posted February 4, 2007 <html> <head> <title>basic php/html</title> </head> <body> <? print "<h3>php</h3>"; ?> </body> </html> Not even this works. I even took off the php code and left the h3 thing all by itself. It work perfect, then I went back to the php code, at it once again. My host is php supported. Is it my hands? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 4, 2007 Share Posted February 4, 2007 <a href="http://www.phpfreaks.com/forums/index.php/topic,124976.msg518598.html#msg518598">Post with same problem</a> Unfortunately her question was never answered...but you could try taking some advice from the post. I honestly have no idea why it would be doing that if you have PHP capabilites. Instead of using "<?" as your opeing tag, try using "<?php"...your sever may not have the short tag turned on. Quote Link to comment Share on other sites More sharing options...
cuteNephilim Posted February 4, 2007 Share Posted February 4, 2007 Do your index file have a php extension to begin with? It doesn't seem like that. Try renaming it to "index.php", the server will not (normally) recognize it as a php file otherwise. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 4, 2007 Author Share Posted February 4, 2007 Okay, beutiful...may be now I can learn something. But thanks for the help, I'll be looking forward to more. Oh and I must put the php extension to all my files correct? I got another question, should be fairly simple. Lets say, I made this page right, got the drop down menu going on...the banner all that good stuff. Now in the middle of page where users "interact" with the website. Example: When you click on the mulimedia link, in the middle of the page is where users can click on the videos, music, or whichever they choose. Now lets say I do not want to re-write every page to those links and then add the "interactivity" into the middle of the page. Is there not a simple way to make the blueprint of the site but when users click the link. The php script picks up the information and relays it to the middle of the page...Instead of copying everything from the index page to every other page and then re-wording what would be in the middle? I think this should consist of the if option in php. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 4, 2007 Share Posted February 4, 2007 Yes, there is a much easier way to keep the same style going throughout your entire site without having to always copy and paste it. I usually create a file called "header.php" and put the layout in that, then I just put: include 'header.php'; at the top of each page I want the layout on. And yes, you would have to use the .php extension on all your PHP files or it won't work. Quote Link to comment Share on other sites More sharing options...
Grassy Posted February 4, 2007 Share Posted February 4, 2007 Gday How are we all? Listen im a complete noob and i want to know what do i need to start writing with PHP and where can i find extra help if im stuck. I need to know a list of programs i will need and i want everything there is too using and writing in PhP it would also be helpful if there was some links to where i might be able to obtain these programs Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 4, 2007 Author Share Posted February 4, 2007 Now the include option can get information from other pages on the website? Lets say...I wrote this review right, put it as rev.php or whichever. Now, in the "interact" part of the site, where I would highlight the option. Using the "if" because obviously there would be more than one. Within the if's, I would use the include option with the file that correspond to the link the user has clicked? Hey Grassy, I suggest you find a free web server with php support or just get paid hosting like I did. Trust me save yourself trying to download all these bullshit programs to run php off your computer. It's best to leave that up to somebody else. haha Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 4, 2007 Share Posted February 4, 2007 Okay...lets see how I can explain this. Lets say I have a file called "page2.php" that contains this code: <?php echo "This is text on page2"; ?> Now this is a file called "page1.php": <?php echo "This is text from page1 <p>"; include 'page2.php'; ?> The code above would print out: This is text from page1 This is text from page2 Because since we included page2 inside of page1, it will take everything from the page2 file and put it where you include it on page1. Do you understand that? So you could pretend page2 was the layout and you wanted to include the layout on page one..all you would do is include the layout page on the top of page1. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 4, 2007 Author Share Posted February 4, 2007 Alright, thanks for the info. I got it. Now I have another problem, ya see. The book I'am learning from wants me to do a little event calender thing. So it gives me 5 event dates to put into a file called "events.txt." So I do, I copy all the codes given to me from the book to make the calendar. When I open the page, it gives me a parse error. Now the events.txt has no php codes just the words. here it is August 4, 2000|7 p.m.|Yo|Shut the fuck up please. Well, thats not fully quoted from the book, and there are more but I doubt you would like to see them. As you can see in the quote thats exactly how it's typed in the events.txt Now, do I have to assign variables and arrays in the events.txt? But it makes no sense because I'm going to call it .txt and therefor the browser will not pick up. As for the coding, here it is. <? $events = fopen("events.txt", "r"); print "<table border = 0 width = 250>"; print "<tr><td valign=top>"; print "<h3>Events Calendar:</h3>"; while (! feof($events)) : $event = fgets($events, 4096): $event_info = explode("|", $event); print "$event_info[0] ( $event_info[1] ) <br>"; print "<b>$event_info[2]</b> <br>"; print "$event_info[3] <br> <br>"; endwile; print "</td></tr></table>"; fclose ($events); ?> Thank you for your time. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted February 4, 2007 Share Posted February 4, 2007 What your book is doing is teaching you how to grab data from a text file. This is called storing information in a "flat file". The text file does not need the .php extension as it is only being read from by your php script. $events = fopen("events.txt", "r"); That opens the text file for reading. I found your error. You need to change this: $event = fgets($events, 4096): To $event = fgets($events, 4096); You put a colon insted of a semi-colon See what that does. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 7, 2007 Author Share Posted February 7, 2007 Alot of hell, thank you. I'll be asking more. Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 7, 2007 Author Share Posted February 7, 2007 This **** is still giving me problems. says unexpected $ on line 27. Can't find it, at all. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 7, 2007 Share Posted February 7, 2007 that means you have a missing } somewhere. Line up your brackets. Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 No brackets in that code, however you wrote endwile; instead of endwhile; Quote Link to comment Share on other sites More sharing options...
Mr. B Posted February 7, 2007 Author Share Posted February 7, 2007 God damn it, finaly. Now excuse me all as I transform into a japanese to dismantle and rebuild. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.