Go Back   BWHacks > Development > Web Development

Web Development Website design and programming, content development. It's all here.

Reply
 
LinkBack Thread Tools

Old 11-17-2006, 12:16 AM   #1 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default Need help with PHP

I want to learn PHP, but first I need to set up a server [Program] like apache, right?

I created a simple .PHP page, here is the source to it (This is not mine):

Code:
<html><body><?phpecho "Hello World";?></body></html>
I save it as apage.php, and it appears as a text document. I have no idea how to acually use it...

What am I doing wrong, and how can I use php when makeing a webpage?
Crystatic 15 0FF11|\|3   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links


Old 11-17-2006, 01:22 AM   #2 (permalink)
MasterX

Disciple
 
MasterX's Avatar
 
Join Date: Mar 2005
Location: Here There Where Ever I Find A Box
Posts: 544
MasterX is a jewel in the rough
Send a message via ICQ to MasterX Send a message via AIM to MasterX Send a message via MSN to MasterX Send a message via Yahoo to MasterX Send a message via Skype™ to MasterX
Default

YOu must install PHP first
i would suggest Reactor Server for beginning windows users, it gives you it all in a lil package

also
Code:
<html><body><?php echo"Hello World"; ?></body></html>
it better formated for your html/php mix
__________________
MasterX 15 0FF11|\|3   Reply With Quote

Old 11-17-2006, 02:24 AM   #3 (permalink)
SC_Modder
Loading javascript...
Senior Member
Moderator

Inquisitor
 
SC_Modder's Avatar
 
Join Date: Nov 2004
Posts: 4,515
SC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond reputeSC_Modder has a reputation beyond repute
Send a message via AIM to SC_Modder
Default

MasterX, you are forbidden to help anyone on this forum.

Ever again.



Ever.

Anyway, use quotations when you save it, IE "apage.php" instead of apage.php. Make sense? Hope so.
__________________
AaronOpfer.com - My music
SC_Modder 15 0FF11|\|3   Reply With Quote

Old 11-17-2006, 03:37 AM   #4 (permalink)
lpxxfaintxx
I hate Steve Jobs.
Senior Member
Gold Member

Enlightened
 
Join Date: Jun 2005
Location: Fullerton, CA
Posts: 3,120
lpxxfaintxx has much to be proud oflpxxfaintxx has much to be proud oflpxxfaintxx has much to be proud oflpxxfaintxx has much to be proud oflpxxfaintxx has much to be proud oflpxxfaintxx has much to be proud of
Send a message via AIM to lpxxfaintxx Send a message via MSN to lpxxfaintxx Send a message via Skype™ to lpxxfaintxx
Default

If you want to save yourself the trouble of setting up a server, take a look at Wamp. http://www.wampserver.com/en/
__________________
lpxxfaintxx 15 0FF11|\|3   Reply With Quote

Old 11-17-2006, 05:43 AM   #5 (permalink)
kds
MENOS EL OSO
Senior Member
Moderator

Saint
 
kds's Avatar
 
Join Date: Sep 2004
Location: South suburbs of Chicago, Illinois
Posts: 6,284
kds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond reputekds has a reputation beyond repute
Default

Yes, I'd also reccomend WAMP.
__________________
GET THE **** OUT OF MY SIGNATURE
kds 15 0FF11|\|3   Reply With Quote

Old 11-17-2006, 08:50 PM   #6 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default

Why do I need WAMP and programs of this sort? How can I upload my .PHP script somewhere, and use it on a forum?

Example: I have an invisionfree board, and I want to put a vote script on the index page. How could I do this?
Crystatic 15 0FF11|\|3   Reply With Quote

Old 11-17-2006, 10:37 PM   #7 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,506
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

PHP is an interpreted language. Therefore, the computer that processes the PHP code must have PHP and any other run-times previously installed. To be able to upload your files to a server via FTP you need to rent webspace and bandwidth from a provider, the server must have PHP installed. Some new things introduced in PHP5 cannot be done without the server having the latest PHP run-times. PHP4 is still the standard among most webservers, since the PHP5 release is relatively new.

I don't think Invisionfree allows the custom uploading of scripts, however - you could try taking a look at the Invision documentation, put your poll code in a plug-in, and use it through Invision's native plug-in installation procedure (the board probably has a built in uploader for that).

The main use for PHP is dynamic content. You can use it to perform complex mathematical algorithms on data dtructures or to dynamically choose based on the control structure of your page to show specialized content.
Dyndrilliac 15 0FF11|\|3   Reply With Quote

Old 11-18-2006, 01:02 AM   #8 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default

So, could I create polls, a clock, skin swapper (Swaps by time) and things of this sort with PHP?

Also, could create a registration system if I wanted? Like, makeing a script in PHP that could make it to where people sign up for a website just like they do forums.
Crystatic 15 0FF11|\|3   Reply With Quote

Old 11-18-2006, 01:17 AM   #9 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,506
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

Yes. This forum and most others are written in PHP. However, people have been switching to ASP.NET and AJAX recently.
Dyndrilliac 15 0FF11|\|3   Reply With Quote

Old 11-19-2006, 04:52 AM   #10 (permalink)
MasterX

Disciple
 
MasterX's Avatar
 
Join Date: Mar 2005
Location: Here There Where Ever I Find A Box
Posts: 544
MasterX is a jewel in the rough
Send a message via ICQ to MasterX Send a message via AIM to MasterX Send a message via MSN to MasterX Send a message via Yahoo to MasterX Send a message via Skype™ to MasterX
Default

SC_Modder confuses me thats for sure and if you have an invision free board that is a little more on the advanced and restricted side of the code

YOu don't have the ability to edit the souce files so you can't do any php mods but you can edit the skins files to an exstent where your ideas could be posable

Also i don't think ajax is near php or asp, since ajax is commenly used with php and probily asp
__________________
MasterX 15 0FF11|\|3   Reply With Quote

Old 11-20-2006, 02:21 AM   #11 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default

Thanks!

Off topic, I need help with something... I wrote this code, but something is wrong. (Javascript)

Code:
 
<script type="text/javascript">
var d= new Date();
document.write("Welcome to 8! Todays date is: November the " + mytime() + ".")
function mytime()
{
document.write(d.getDate())
}
</script>
The result is this:
19Welcome to 8! Todays date is: November the undefined.

The result I needed was this:
Welcome to 8! Todays date is: November the 19.
Crystatic 15 0FF11|\|3   Reply With Quote

Old 11-20-2006, 03:46 AM   #12 (permalink)
Dyndrilliac

Blessed
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,506
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via MSN to Dyndrilliac
Default

Your function isn't returning a numerical value. What happens is that at compile time (at the time that the machine compiles the javascript code and processes the output), all functions are executed. Since your function is calling a function and outputting the data to screen (instead of returning the value to the invoker), the function gets resolved to it's output, and so the number "19" gets written to the screen. The original output gets printed, where you called your function. And since you didn't return a value, the value that you make reference to is undefined.
Dyndrilliac 15 0FF11|\|3   Reply With Quote

Old 11-20-2006, 04:30 AM   #13 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default

So, instead of the function calling another function to print something onto the screen..

I should make a function return the value of getDate() to the invoker? If yes, how could I do this, and how would I achieve the same result I needed?
Crystatic 15 0FF11|\|3   Reply With Quote

Old 11-21-2006, 04:20 PM   #14 (permalink)
YonderKnight
Senior Member
Gold Member

Evangelist
 
YonderKnight's Avatar
 
Join Date: Sep 2004
Location: USA, California
Posts: 1,392
YonderKnight is a name known to allYonderKnight is a name known to allYonderKnight is a name known to allYonderKnight is a name known to all
Send a message via AIM to YonderKnight
Default

Code:
<script type="text/javascript">
var d= new Date();
document.write("Welcome to 8! Todays date is: November the " + mytime() + ".")
function mytime()
{
 return  d.getDate()
}
</script>
Also, you don't have to have mytime() as a separate function since it's pretty simple.

Code:
document.write("Welcome to 8! Todays date is: November the " + d.getDate() + ".")
__________________
New AIM S/N - TooHyeToReply
YonderKnight 15 0FF11|\|3   Reply With Quote

Old 11-22-2006, 04:29 AM   #15 (permalink)
Crystatic

Deviant
 
Join Date: Aug 2006
Posts: 44
Crystatic is on a distinguished road
Default

Thanks!

This may seem strange, but im curious.

"txt.bold()" Makes text bold, and bold() is a function, right? So, where is this function defined?
Crystatic 15 0FF11|\|3   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Advertisement

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On