Files on the web.

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Files on the web.

Post by Shoeman on Sun Oct 09, 2016 9:08 am
([msg=92998]see Files on the web.[/msg])

Ok, so I have been trying to make a chatroom in a website so my friends and I could talk privately. I am not new to codeing webpages, but new to the sever side of things. Every tutorial about this has you calling a file with some php in it. The only problem is that I don't think you can make a file on the web, that is designate a certain portion of code into a file. So how would I do this, create a file on a webpage?
<script>var greetings = "hello and goodbye";</script>
Shoeman
New User
New User
 
Posts: 5
Joined: Sun Oct 09, 2016 9:02 am
Location: Tomsk, Tomsk Oblast, Russia
Blog: View Blog (0)


Re: Files on the web.

Post by tremor77 on Tue Oct 11, 2016 12:44 am
([msg=93005]see Re: Files on the web.[/msg])

http://php.net/manual/en/function.fopen.php

assuming directory permissions are correctly set. I'm a bit confused as to what you mean when you say "The only problem is that I don't think you can make a file on the web, that is designate a certain portion of code into a file. So how would I do this, create a file on a webpage?"

Webpages are all files, they require hosting and a web server, is there some basic understanding that you are missing perhaps?
Image
User avatar
tremor77
Addict
Addict
 
Posts: 1097
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Files on the web.

Post by Shoeman on Wed Nov 09, 2016 11:12 am
([msg=93085]see Re: Files on the web.[/msg])

Sorry, I worded that a bit weird. How would you import the php file into the code? Or do you just name it and it imports it?
<script>var greetings = "hello and goodbye";</script>
Shoeman
New User
New User
 
Posts: 5
Joined: Sun Oct 09, 2016 9:02 am
Location: Tomsk, Tomsk Oblast, Russia
Blog: View Blog (0)


Re: Files on the web.

Post by darkcart on Mon Nov 14, 2016 9:44 pm
([msg=93104]see Re: Files on the web.[/msg])

From what I get what you're trying to do is include a PHP file. If that's so, it's trivial to put this at the beginning of your code.

Code: Select all
require 'yourfile.php'
darkcart
New User
New User
 
Posts: 7
Joined: Sat Jan 23, 2016 5:12 pm
Blog: View Blog (0)



Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests