Jump to content

<? include("include/session.php"); ?>


jamesjmann

Recommended Posts

i would first of all recommend you use <?php  as starting tag instead of <?

 

And concerning your question, if you open up a php file locally without having a server with php installed you will ofcourse see all the code. install xampp for instance and run it again.

Link to comment
Share on other sites

i would first of all recommend you use <?php  as starting tag instead of <?

 

And concerning your question, if you open up a php file locally without having a server with php installed you will ofcourse see all the code. install xampp for instance and run it again.

 

I have quite a few php documents that open up just fine off a web server (i.e., i can view the markup on them). It's just when I add that little bit of code at the very top of the php document, the markup no longer becomes visible.

Link to comment
Share on other sites

i would first of all recommend you use <?php  as starting tag instead of <?

 

And concerning your question, if you open up a php file locally without having a server with php installed you will ofcourse see all the code. install xampp for instance and run it again.

 

I have quite a few php documents that open up just fine off a web server (i.e., i can view the markup on them). It's just when I add that little bit of code at the very top of the php document, the markup no longer becomes visible.

 

Well do as you like and use shorttags if you think that is the way to go i don't mind. About opening stuff in your browser locally without a server running( because that is what ou said you did). see my answer again. Post your code. including the stuff you include.

Link to comment
Share on other sites

Sounds like you are doing exactly what I did when I wrote my first php program a couple of weeks ago. Since a .html program would execute and display in the browser, I figured a .php program would do the same thing. Doesn't exactly work that way if you don't have all the "goodies" installed on your PC.

 

I changed my file associations to open .php with wordpad because notepad screws up the format.

Link to comment
Share on other sites

Use full <?php open tags. Short <? open tags are now disabled by default. See what happens when you do that.

 

It works on my web server with both forms of php tags. It's just when I test it off the server without xamp, wamp, apache, etc. it comes up as code. i tried changing the "<?" to "<?php" but that didn't do anything. I'm forced to conclude that the only way to resolve this issue, is either eliminate the code from the document altogether, or just resort to testing my css/html through my web server only.  ::)

Link to comment
Share on other sites

Well, of course. You can't expect that code such as PHP, that must be parsed by an interpreter on a webserver will function without the use of a webserver.

 

Yes, that makes sense, HOWEVER, all of my other php scripts within the <html></html> tags do NOT affect my html or css online or off.

 

Is it because the php script is outside the <html></html> tags? Or is it just that particular function that causes this?

Link to comment
Share on other sites

Your not making allot of sense. PHP needs to be interpreted by it's parser which is an extension to a web server. Hence php needs a web server to work.

 

I know that. All php codes inside the <html></html> in my documents don't work, but don't affect the css/html when viewed in a browser offline. If you put php code outside of the <html></html> offline, the php code doesn't work, but it also affects my markup and css and I can't test my html offline before uploading it.

 

Does that make sense? lol.

Link to comment
Share on other sites

PHP does not care about being inside or outside of <html></html> tags. As for the rest, no, it doesn't make allot of sense.

 

Lol, I'm sorry. Sometimes php confuses me.

 

But anyway, I think I know why it's doing that. I just download a script that is similar to my document(s) and it does the same thing so I'm guessing that that's just the way it is.

 

Thanks all for your replies!

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.