Xhtml/php/css?

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
Well this is a lil question from a student who has experience in web-dev (HTML and CSS). Bt obviously those are the easy languages out there.
Also I have experience in software-engineering (C,C++ and C#)

Now I'm having this new 'student job'.
It's from a company wich wants me to make websites for their clients
The sites needs to work with a :

*online shop
*allowing users to create profiles
*interact with databases
*interact with http://en.mylivepage.com/
*etc.

Now I'm not really sure wich language I'll have to learn for that..
Is it Java? PHP? XHTML?

I don't really have a clue wich language is best for the job, or maybe a combination?

I hope some of the more experienced guys here can help me out :)

PS: I got the job because of my knowledge about the C languages. Since PHP looks a lot like C++ ..

Greetings,
Michaël
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
PHP will probably be the best, and that is also what I always use for any server side stuff that needs to be done.

ASP is another choice.. But I have no experience in that.

So, basically I think PHP will be the best if close to best if it isn't the best.
Yeah, my first idea as well :)
And it's sweet I can do all that in OSX (I'm a switcher and loving it)
Btw, do you have any great online resources for PHP?
So far I'm studying from PHPMac and the Books included in Coda.

Greetings
 
Yeah, my first idea as well :)
And it's sweet I can do all that in OSX (I'm a switcher and loving it)
Btw, do you have any great online resources for PHP?
So far I'm studying from PHPMac and the Books included in Coda.

Greetings
I don't really have any good online resources for PHP.. I used a huge book to learn, and I left my PHP book at my parents house so, I can't give you the name of that. sorry.
But..
PHP.net 's manual seems fairly good. http://www.php.net/manual/en/
And they also have reference for all the functions, thats really helpful.

ALSO:
And installing php is easy also.. Just download the binary from here http://www.entropy.ch/software/macosx/php/

BTW:
Welcome to the awesome mac world!
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
Yes idd, I think I allready enables PHP:

I downloaded MAMP
I got the "httpd conf" file changed through the Terminal

When I open MAMP, a webpage opens, telling me PHP is installed on my mac :)
That's all that needs to be done I think.
I didn't download any binary I think, but maybe it came along with MAMP?

Also, the tutorial site is great. I think I'll better start studying/experimenting now ;)
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
Hmmm..

I installed MAMP
Is it necesarry to install a package like XAMPP in order to develop localy?
Srry for all the questions ;) I just don't have much experience with the server-stuff
 
Hmmm..

I installed MAMP
Is it necesarry to install a package like XAMPP in order to develop localy?
Srry for all the questions ;) I just don't have much experience with the server-stuff
Well if its mamp (MacOs Apache MySQL PHP) then that should be all you need to develop locally. When you start the server on your computer you and anyone on your network will have access to it.

XAMPP Just stands for Windows/Mac/Linux Apache MySQL PHP Python
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
lil problem:



coda:



seems like theres a problem with the parsing?
MAMP says everything is ok, also my php files are in the right directory :)
 

macfaninpdx

macrumors regular
Mar 6, 2007
198
0
seems like theres a problem with the parsing?
MAMP says everything is ok, also my php files are in the right directory :)
You need to save the file with a .php extension for apache to know to parse the php in the file. Even if the beginning (or most) of the code is <html>, it still needs a .php extension.
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
Something isnt clear to me :

Code:
<HTML>

  <HEAD>
     <TITLE>Mijn eerste PHP pagina</TITLE>
  </HEAD>

  <BODY>
      <?php
   echo ("Hello world"); 
   ?> 
  </BODY>

</HTML>
or

Code:
<HTML>

  <HEAD>
     <TITLE>Mijn eerste PHP pagina</TITLE>
  </HEAD>

  <BODY>
      <?php
   echo <p>'Hello world'</p> ; 
   ?> 
  </BODY>

</HTML>
I saw both being used, only the 2nd one gets me this:


the first one returns nothing :x

MAMP says Apache and mySQL server is up, also the directory is configurated correctly..

The problem is probably easy, but can't find it.
So: Wich code is the right one? and how do i get it to work? :x

Greetings

edit: if its hard to explain, my skype is MichaelBE85
 

macfaninpdx

macrumors regular
Mar 6, 2007
198
0
Code:
<HTML>

  <HEAD>
     <TITLE>Mijn eerste PHP pagina</TITLE>
  </HEAD>

  <BODY>
      <?php
   echo <p>'Hello world'</p> ; 
   ?> 
  </BODY>

</HTML>
I saw both being used, only the 2nd one gets me this:


the first one returns nothing :x

MAMP says Apache and mySQL server is up, also the directory is configurated correctly..

The problem is probably easy, but can't find it.
So: Wich code is the right one? and how do i get it to work? :x
Echo is not technically a PHP function - it is a language construct. So you can use echo with or without paranthesees. So thse are all correct:
PHP:
echo ("Hello World");
echo "Hello World";
echo "Hello", " ", "World";
The problem in your non-working code is that the <p> tags are not in the quotation marks. Try this:
Code:
<HTML>

  <HEAD>
     <TITLE>Mijn eerste PHP pagina</TITLE>
  </HEAD>

  <BODY>
      <?php
   echo '<p>Hello world</p>'; 
   ?> 
  </BODY>

</HTML>
If it is still giving you problems, try using double-quotes instead of single.
 

michael85

macrumors newbie
Original poster
Jul 5, 2007
17
0
Antwerp, Belgium
Doesn't change a thing, and when I use double-quotes, the output just shows the same, except with double-quotes..

Kinda annoying, can't start with this problem lying around :(
 

Mr.nix

macrumors member
Jan 30, 2007
68
0
if you are testing it with MAMP, it needs to be in a folder called htdoc in the MAMP folder, and you need to open MAMP. So the php files should be in a directory like so:
/Applications/MAMP/htdocs/
but when mamp is open, you access them like this:
http://localhost:8888/
What he said is correct. So you'll need something like this

http://localhost:8888/index.php

As far as your code, single quotes are fine for what you're doing there. No need for double.