php/html question

hello, i am new here, but even more new to php. I just took over managing a friends site, and the previous coder has a plethora of unorganized files, several of them php. Most if not all of my experience is HTML and CSS. The first thing I noticed, is not all of the code shows up in my editor, and im not sure how do make changes to a page i cant see any content to. I guess that’s my first question. If I view source in a browser, i see it all, but in any editor, it doesnt show me the same things, hence i cant edit.
I could really use some help, incredibly ABC 123 breaking it down help.
Thank you in advance!!

You can read the tutorials on this site and google is your buddy… LOL… But, here are some basics…

First, there is a SERVER and a CLIENT. I know, that sounds silly, but, see if you can follow this…
Databases are SERVER-SIDE. Browsers are CLIENT-SIDE. PHP, is SERVER-SIDE. Javascript in it’s basic form is CLIENT-SIDE. So, you have something like this:

SERVER(your hosting company) CLIENT(your computer)
Databases Browser (IE, FF, Safari, Chrome, etc)
PHP engine Javascript (basic version, others can be on server)
Other server programming systems Browser Plugin’s (Some can access server code)

Now that I have you all mixed up… A PHP system usually starts with a homepage. This page is mixed with HTML, CSS, Javascript and PHP. The page is called by going to it’s URL. (www.mydomain.com)
This page is first scanned by the PHP system on the SERVER-SIDE. The PHP code is processed and
the output of it combined with any HTML and Javascript is POSTED to the browser. The browser takes
this file and combines it with CSS styles and any plugins used and RENDERS it into a viewable version
and displays it on the screen. At that point, there is NO PHP code inside it. Go to any page in the world
and RIGHT-CLICK on it and select VIEW-SOURCE to look at the source of any displayed page. You will
not see any PHP code. This is because it is handled ONLY SERVER-SIDE. The PHP code does it’s job on
the server BEFORE it is sent to the local user’s computer. The page you are reading at this moment was
created using PHP and sent to your browser which “rendered” the output using the pretty blue CSS code
and then displayed it inside your current window. RIGHT-CLICK and look at the source. No PHP will be
seen. You may see Javascript or other plugin data, but, never PHP. Oh, you will see any PHP code that
was posted inside a text field for display, but, that is not live executable PHP code. It is just text.
So, now that I have covered all of these topics, let’s talk about your problem. First, taking over some
other persons code is a pain. You must organize all of their files into something that makes sense to
you and then print and view and whatever… Next, you have to connect via FTP and look at these files in
your editor. The live files will contain PHP code that creates “content” or more code from sources and
sends it to the browser. You really need some experience with PHP to read someone else’s code and
understand it. I would start with the home page. Most likely it is just a log-in form. It should have
some options that the user selects. Then, it is sent, most likely from a FORM and most likely will be
sent to a PHP file that sorts out the data that was entered into the FORM. Start with that page and
try to follow where it sends the data. Then branch out from there…
Good luck, sounds like you need to do a lot of Google searches and post more questions here…

Hello Ernie, thank you for explaining.
Yes, I am connecting via FTP, I use GoLive, and occasionally Dreamwever, which is what my initial question was relating to. The PHP files show the css, and php, but again, thats not what i need to edit. So i guess my question is how does on edit that information?
And yes, Google has been my main source for help with this, and this guys method of organizing is a bloody nightmare…so im doing my best to sort it out.
I just dont know how to help my friend if i cant figure out the php stuff…

So, you have HTML, CSS and PHP as your programming code. I use Dreamweaver, too. I load pages into it and it pulls the underlying CSS code which is nice because you can look at either with one click.

Remember that the PHP is used for database access and for calculations and altering the flow of the HTML.
Optionally, PHP can change the output of HTML using IF-THEN’s… If a variable = 1 show this HTML code, it it = 2 then show some other code… ETC… So, without seeing all of your code, I would guess you would be seeing a lot of PHP code that is used for data pulling from a database and handling that data along with various optional displays of data and maybe HTML. You will have to study hard and learn what every page does and the flow of each page. You will have to know which pages call which other pages and make a flow chart of the flow of the pages. Then, after understanding which pages call which others, you can created some comments inside each page that explains what the data in each is used for.
Yes, this will take some time. It could take a month depending on how complicated it is. Learning the site is very important if you continue to maintain it. (Charge your buddy double! LOL)

Good luck and ask any individual PHP questions you may have…

Ya, ive kinda been dreading this for a bit…I would change the php pages to html, however the main php page that im referring to, is one where he (the owner) is able to logon as admin, and easily update himself. So if i take that away, that will screw him up. I guess my question still remains Ernie, is how do i get the page edited.

Just open it in Dreamweaver. I think you said you were using that. Dreamweaver will open any website page of any type. You should FTP his entire site over to your computer inside a folder with his site’s name on it. Including all subfolders. Then, go the the main page which you said was .php and right-click on it and select Edit-with-Adobe-Dreamweaver. It will open so you can edit it. Easy… (Well, if you have learned the PHP coding… LOL)… Hope that helps…

PS: When you FTP his site over, you can not copy his database over. So, your testing will have to be done online. We can talk about how to do that later one after you get hands on the files…

i have them locally, but through dream weaver, i connect to the server directly.

Well, that is dangerous as you can trash the site. Normally, you “play” with the site locally and when it works exactly as you want, you move the altered files onto the live site. In that way, it will not crash the site. Also, you need to make backups of the site often during the development stages. It is easy locally, just copy the site folder and date it or add a comment to the folder name such as “mysite.com before login-page changes”… Or whatever helps you remember which version that is.

Anyway, Dreamweaver WILL open php files. You can click on the OPEN button and then where it says open files of type, change that to * or to PHP…

let me rephrase…Dreamweaver opens the page, no problem…but again, i was inquiring on how to get the php info to show to edit it, but i guess its not possible.

Well, you can do it two ways. You can set up live data, I think it is under VIEW tab and set up a connection to your data in the database. Remember, doing it this way will be working on the LIVE data. The other way is to set up a local server. You can use the XAMPP system. This is a free download that sets up a server with PHP, java, everything you need in one download. It basically allows you to set up a server with PHP and MySQL on your own system and then you can test any way you wish. Here is a link for it:
http://www.apachefriends.org/en/xampp-windows.html

Either way would work for you. I did not understand you meant you wanted to see the “LIVE” data.
Pick the best one for your use. If his site is not live, just use the LIVE-VIEW in DW… Good luck.

Ernie, sorry if i wasnt clear…Yes, that is what im having trouble editing/working with, because i cannot see it.
Also, thanks for the link, but Im on a Mac. :frowning:

Well, just use DreamWeaver’s LIVE-VIEW…

Since you have the site already set up in DW, you go to the VIEW tab and select LIVE-VIEW SETUP.
Once set up, you can use the button at the top to view your data live… It should work for you…

Im not seeing Live/Live view

Well, it should be under the VIEW button across the top menu…

Which version are you using? There should be an option for LiveData or LiveView somewhere…

Dreamweaver, CS 3, and I am on a MAC OSX 10.6.8.
Also, the link you sent me was for pc, is there one for mac?

Well, the bad news is that “Live View” started in CS4. I am using CS4…

Can you upgrade? If not, you have to view it on a server. You could set up a server system for testing and load a version of the code onto it for testing purposes. Or, if your current live server is available, you might be able to create a second version of the site. It depends if the site is currently live or not.

Sorry, I could not be more useful… (I would get your friend to pay for your DW upgrade… LOL)

Sponsor our Newsletter | Privacy Policy | Terms of Service