By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,470 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,470 IT Pros & Developers. It's quick & easy.

first ever PHP site does not have a source...

P: n/a
Hi Gurus

I am just putting my first PHP site together...

One thing that I think it strange is that I do not seem to be able to view
the source. It is almost like the page does not load properly...

If you like then I can email you the source code, but I thought that this
may be a problem that occurs frequently...

TIA

- Nicolaas
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
This is because PHP is a server side programming language. You only
see the output of what PHP processes; not the source itself.

If I did not understand your question please try to clarify; but I
think that should answer it for you.

Jul 17 '05 #2

P: n/a
circa is correct...but thats a confusing way to put it.

When you view a PHP file in your browser, here is the sequence that
takes place:
1. Your browser sends a request to the server for whatever.php
2. When your server sees that the file you have requested has the file
extention .php, it interprets (or runs) the program.
3. The browser sends you the output, or the results of the program; not
the source code.

So your browser never even recieves the raw PHP code for the page.
This is called a server-side language, as opposed to a client-side
language like Javascript. This is one of the useful things about PHP.
You can hide things like a large database from the user to prevent them
from copying the whole thing onto their site; then you just allow them
access to small parts of it by means of a search box.

As for the page not loading correctly, there are tons of possibilities;
me more specific. But it is most likely either a syntax error or an
endless loop. In any other type of error, the page will still load.
If it is a syntax error, then it is probably because you left off a
semi-colon at the end of a line. I've been writing PHP forever and I
still do that sometimes. On most servers, for some reason, if there is
a syntax error on the page, it simply returns to the browser
"<html><head></head><body></body></html>" so if you see that in the
view source, that tells you it's a syntax error.
If it's an endless loop, which is less likely, the page won't load at
all; it will just sit there saying "Contacting whatever.com" in the
status bar until it times out. Or some servers will time out after 30
seconds and send a message back to the browser giving a description of
the problem.
An endless loop is caused by some type of repitition structure (either
while, for, foreach, or do while) that never ends. For example, this
would cause an endless loop:
<?php
$flag = 1;
while($flag = 1)
{
echo 'hello world<br />';
}
?>

Jul 17 '05 #3

P: n/a

<ci*******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
This is because PHP is a server side programming language. You only
see the output of what PHP processes; not the source itself.

If I did not understand your question please try to clarify; but I
think that should answer it for you.


Sorry, what I actually meant was that if I right mouse-click to see the
source or if I go to edit - view source, this function is unavailable. It
is even that bad that if I go save as ... and try to save the file locally
as a text file then it tells me that the file is unavailable....

I hope my problem seems a little less silly now.

Thank you for taking the time to answer.
- Nicolaas
Jul 17 '05 #4

P: n/a

"DJ Craig" <sp**@djtricities.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
circa is correct...but thats a confusing way to put it.

When you view a PHP file in your browser, here is the sequence that
takes place:
1. Your browser sends a request to the server for whatever.php
2. When your server sees that the file you have requested has the file
extention .php, it interprets (or runs) the program.
3. The browser sends you the output, or the results of the program; not
the source code.

So your browser never even recieves the raw PHP code for the page.
This is called a server-side language, as opposed to a client-side
language like Javascript. This is one of the useful things about PHP.
You can hide things like a large database from the user to prevent them
from copying the whole thing onto their site; then you just allow them
access to small parts of it by means of a search box.

As for the page not loading correctly, there are tons of possibilities;
me more specific. But it is most likely either a syntax error or an
endless loop. In any other type of error, the page will still load.
If it is a syntax error, then it is probably because you left off a
semi-colon at the end of a line. I've been writing PHP forever and I
still do that sometimes. On most servers, for some reason, if there is
a syntax error on the page, it simply returns to the browser
"<html><head></head><body></body></html>" so if you see that in the
view source, that tells you it's a syntax error.
If it's an endless loop, which is less likely, the page won't load at
all; it will just sit there saying "Contacting whatever.com" in the
status bar until it times out. Or some servers will time out after 30
seconds and send a message back to the browser giving a description of
the problem.
An endless loop is caused by some type of repitition structure (either
while, for, foreach, or do while) that never ends. For example, this
would cause an endless loop:
<?php
$flag = 1;
while($flag = 1)
{
echo 'hello world<br />';
}
?>


Hi Craig

Thank you for your in-depth description.

I am afraid that it is none of the above, as the page loads perfectly.

Unfortunately, I can not post you the url at the moment, because I would
have to check with my client first. Would you like me to send you the file
PHP or post it on here? If so, how do I do that, if I post it to the
newsgroup. Can I attach it or just copy and paste below?

Jul 17 '05 #5

P: n/a
"WindAndWaves" <ac****@ngaru.com> wrote in message
news:PC*******************@news.xtra.co.nz...

<ci*******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
This is because PHP is a server side programming language. You only
see the output of what PHP processes; not the source itself.

If I did not understand your question please try to clarify; but I
think that should answer it for you.


Sorry, what I actually meant was that if I right mouse-click to see the
source or if I go to edit - view source, this function is unavailable. It
is even that bad that if I go save as ... and try to save the file locally
as a text file then it tells me that the file is unavailable....

I hope my problem seems a little less silly now.


It sounds like there may be some javascript on that page disabling the
options for viewing/saving the source.

--
Virgil
Jul 17 '05 #6

P: n/a
Thats really weird. Have you tried it in different browsers? Try
disabling java and javascript in the preferences and see if that makes
any difference. if you have a DOM inspector try running that on it and
see what it says. If you don't have one download Firefox (a great
browser!) at http://www.firefox.com then install the web developer
extention (Tools -> Extentions -> Get More Extentions) btw does anyone
know of any stand-alone DOM inspector applications? My fingers are too
tired to explain what a DOM inspector is :) but its pretty simple just
mess with it some.
Have you tried it in different browsers? Try disabling java and
javascript in the preferences and see if that makes any difference.
If you want a good browser for testing sites on, again, download
firefox and the web developer extention.
If this doesn't help, just copy and paste the source code into here.

Jul 17 '05 #7

P: n/a

"DJ Craig" <sp**@djtricities.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Thats really weird. Have you tried it in different browsers? Try
disabling java and javascript in the preferences and see if that makes
any difference. if you have a DOM inspector try running that on it and
see what it says. If you don't have one download Firefox (a great
browser!) at http://www.firefox.com then install the web developer
extention (Tools -> Extentions -> Get More Extentions) btw does anyone
know of any stand-alone DOM inspector applications? My fingers are too
tired to explain what a DOM inspector is :) but its pretty simple just
mess with it some.
Have you tried it in different browsers? Try disabling java and
javascript in the preferences and see if that makes any difference.
If you want a good browser for testing sites on, again, download
firefox and the web developer extention.
If this doesn't help, just copy and paste the source code into here.


Hi Dj

I think I know what it was, and yes I do have firefox. I think the little
line in my stylesheet

BODY {background: URL()}

may have been in the way, or something like that, anyway, I will do some
more research, because it could still be the php....

Javascript has little to do with it I think, even though I have several of
the scripts running, as the error only occurs on the server and it never
used to when the pages were still *.html

Thanks for your comments

- Nicolaas
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.