What is PHP

Hi!
INTRO: everybody has to make a start, no one was born with knowing everything. CIS Majors, self learning, computer freaks, programmers etc…
Under “php WIKIPEDIA” someone will find pretty much about that programming language,… however here and then seem to appear questions which could interest newbies.
(If I did not notice a similar topic, please merge or delete this.)

QUESTION:

  • Can a website stand only in php,or is it integrated in HTML, if it would stand completely alone, can you build a layout, with columns headers and footers?

  • Is PHP actually a script to make functions, like put in age and day of birth in an front end.

  • Is a programming configuration software like for example Dreamweaver supporting php, showing with a split screen actually in real mode whats been programmed?

Thanks a lot!!
Jason

Well. PHP stands for “PHP Hypertext Preprocessor”

Does a website need to have HTML?
No, I guess a site could be backend only. But by far most PHP sites do generate HTML at least in part. IIRC that was one of the main uses it was originally created for.

PHP does not need to display only HTML, but it needs to generate something a browser will be able to use be it HTML, XML, plain text, images, PDFs, JSON etc.

PHP is not a script, it is a programming language.

If you want to create a website that has a front end I strongly suggest you get a sound footing in HTML first.

DreamWeaver? I’ve never used it nor have I ever had any desire to use it so I can’t offer anything there.

You can’t run PHP in Dreamweaver. You need a web server such as Apache or Nginx and the PHP software.

both is incorrect.

a website is basically an application that is used through a browser. so essentially a website is made of anything a browser can understand. which for the most part is HTML code, but can also be binary files (images, PDFs), etc.

which comes to the second important point, the browser gets its data from a server. how that server creates the necessary data is of absolutely no concern to the browser at all. if it would work you could even knit a web page, the browser wouldn’t care as long as it can process the data.

Thank You,
it was really helpful !! to understand and get the picture.

Websites have to be not only functional but also attractive, it is very important to make it catchy, pretty, name it as you like but it is of the same importance nowadays. Don’t misunderstand this with complexity, it can be plain, but pretty.
I had a partner who gave a lot of emphasis on SEO, saying it is important to bring the people on the website, that’s the hot deal, but me on the other hand … i am convinced that if its not attractive and of course functional you will not stay much on that but go on, its scary but there is no place for second place out there i figured out… if a website is great doing a great job, why to go to number 2, its only a click.

And everything on CIS is going so fast…

I was proud making good looking pages with HTML, when I learned somehow to edit CSS it was great not to change every single page… then… I was amazed by CMS templates and that I could manage from a back end.

Now I got faced with PHP, that happened because I am trying to make a website for Classifieds and searching on the net I found out that using Osclass for such a page will be pretty much professional. So i try to make it look good and it needs customization and from what i see its pretty much on PHP.

I mainly started with print and Graphic design, but the internet overwhelmed print and its pretty much the future. I am auto- didactic its tough… but i like it a lot.

Thank You again for your answers above, they helped me a lot.

using PHP to generate html pages or writing html outright will have the same end result to the user. What server side languages will allow you to do though is connect to databases and provide dynamic content. You could have 500 html pages but that is hard to manage if you have to edit each one if there is a small change to the header for example. If you have a single template page and use PHP (or other server side language) to return the content from the database you should be able to manage everything better and provide addition functions such as being able to search for content in the database and return matching results. It’s hard to do that will pure html pages. You can also do additional things like send emails (if your server allows) and upload images or even create images on the fly.

Noppy,

on your example, is it so that like I would control the text color with CSS on the 500 pages, is it alike that with php I will control functions on that 500 pages?

Logic, Markup and Style are three separate things, relating to PHP, HTML and CSS. For that rule you already defined a <style href="..."> across your HTML files and only have to change the CSS file to get the change everywhere.

1 Like

not quite. as @chorn says they are separate. So i have a site with 500 pages for example

I would set up a template page in php. In this page i would have a stylesheet (css) defined. This would just be a link a normal css stylesheet. It would contain all the styles needed for the site. so <p> tags etc would be defined so i wouldn’t have to style every paragraph on every page. Up until this point no php is needed this is just a standard page+css setup.

i would then use php to connect to the database of pages and depending on the url variable (?page=1, or ?page=how-to-use-chopsticks, or even example.com/how-to-use-chopsticks (if i was using some php trickery to clean the url like amazon etc does)) it would look up that in the database and return the matching result and output the content to the page. The content should be plain html formatting so the stylesheet you defined int he beginning will apply to the content you have just ouput.

If you want to change the paragraph formatting and make all the text red on your site you now just have to change the css in your 1 stylesheet and it will apply to all 500 pages. If you want to change the heading menu you would just change that in the template you set up and it would apply to all ‘pages’ (content from your database). If you want to get more fancy you can add variables and change the template file. for example ?page=1&template=winter

The page variable would return page 1 from the database and the template variable would use the winter template. Change the variables and you can change the page and the template that is being used. You can make as many templates as you like and called the variable and its value whatever you want and then on your php page you then just use the variable and it’s value to switch between templates.

hope that makes sense.

1 Like

:smiley: it was originally called Personal Home Page at one point in its beginning life.

@SEE
PHP is basically a server-side language. It isn’t a replacement for HTML. When you request a website that runs on PHP, the request gets sent to HTTP first. Then depending on what is in the header, the header will get rendered first. PHP can also modify the headers to suit the user’s needs as well. Here is an example.

header('Content-Type: application/Json');

This bit of snippet allows PHP to convert the page to Json format. This in turn can allow you to work with json_decode and json_encode.

I am not sure if PHP gets executed before or after the headers get sent. But after that, the HTML elements get rendered. So you could say that PHP or any server-side language will be executed before the HTML elements get rendered.

You can basically use PHP to create a dynamic website.


Websites like Facebook and Myspace (way earlier days before they started using cfm) use PHP. Most clones of Youtube and Twitter run on PHP as well.

2 Likes

Must be before or else you couldn’t do a database query and return results and then tell the page to send the headers as .json etc. You just can’t output anything before the headers including whitespace.

1 Like

HTTP is the transfer protocol, not the request target (that would be the server itself).

So the flow is more like Browser => Computer => Web server => PHP => Web server => Computer => Browser

1 Like

Well, wouldn’t that cause a fatal error for headers already sent? If PHP gets executed before headers, all those print, print_r, echo, and var_dump would cause it to return the headers already sent measage. Because in theory, you output before headers, that will basically return that message, but if it gets executed after headers, then how is it possible to modify headers so that the headers don’t return that message?

I thought you’re supposed to do everything after the headers since if you output before headers, the returned message will be headers already sent.

So I would say this is a very trick question that can go either way. Unless the method is confirmed.

It was so long ago that I don’t remember the specifics.

But I had a small problem with my htaccess not handling things the way I had expected it to (request error handling IIRC).

The answer had to do with the difference between PHP as Apache mod_php vs. PHP as FastCGI

I think it was something about the way the server handled HTTP requests, and that in some cases the request was passed off directly to the PHP engine by-passing the htaccess file…

This is just my thinking as i am (really) far from an expert but if you wanted to run a query and return a .csv for example, i would do the database query first and then send the headers after the query to say it is a .csv and then output the data in the .csv format. I might be talking rubbish but i think php is dealt with first and then the headers. It gets more confusing when you add in output_buffering as it won’t send anything to the page until you need it so you can do things like set cookies first without getting the ‘headers already sent’ message.

but i think we’ve got quite advanced from the OP’s question :slight_smile:

1 Like

I like this Guy! I took this 1st lesson and got a great picture! I really recommend this video for beginners.

If I understood it correctly, php sends from the server ready processed files as html to your desktop.
I liked especially the Sentence where he said…
HTML is for making text blocks etc… CSS for making it looking fancy and pretty, Java Script is the flashy things, like when you hoover with your mouse over and somewhere else something happens and php does the functional thing like when you insert somewhere your date of birth and it tells you your age…inserting data, being processed on the server and getting it back to you…

Coo Stuff!!
Bonus Stuff i got from that…to work on Notepad++, wow I overslept that totally…where have I been!!

Indeed we have. My recommendation to OP is that if they truly want to learn PHP, they need to read something that is more up-to-date. It’s going to help tremendously.

@SEE
I think of it as a human body.

HTML is basically your body markup. It makes you how tall you are, how big your chin is going to be, etc.

CSS is basically what makes you look beautiful. It makes you who you are such as skin tone, hair color, eye color, etc.

Javascript is basically how your body behaves such as how you walk, talk, etc.

PHP is like your soul. You can never see it, but you know it’s there.

1 Like

very nice metaphor!!

However, on this osclass template I am working on, I try to modify some text, for example in an e-mail form I would like to change the text in front of the Cell like instead of location write something else. I cant find that text… where is it? CSS its not since its to make it pretty, .php…I dont see any text in the files but functions, so it should be in an .html file?.. but i don’t find any… Where should I look at for the text? If you need a hint here is the link I am working on…

http://e-vape.deals/now/index.php?page=item&action=item_add

and i look to change at the left the box intros, ZIP for example…

Thanks for helping… its the first time I do something completely out of a CMS like WP or Joomla.

awsome, I fixed it. indeed in the lang folder, had to change the .po and .mo file, I used this…

:slight_smile: