Jump to content

Newbie Help


Mr. B

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Okay, beutiful...may be now I can learn something. 8)   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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.