Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

php programing

Posted on 2012-08-22
18
Medium Priority
?
306 Views
Last Modified: 2012-08-22
I need to be able to edit php files.
I have complete access to all the files on my site, through ftp.
I am well used to editing html files but have never accessed any php file.
I do NOT need to make programing changes to the php files.  
I need to be able to add and change  text on the page and edit the Title and Description in the head section.
Could someone please explain to me how I can do this without having to keep sending requests back and forth to my developer.
Thanks
0
Comment
Question by:digisel
  • 9
  • 7
  • 2
18 Comments
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320293
There is the (slightly dangerous) option of editing the file sort-of directly. Using an FTP program like Filezilla (Its fantastic) you can right click any file and click edit. It downloads a copy of the file. The file will open in the editor of your choice (I recommend Notepad++ or Sublime Text) and Filezilla will monitor the file for changes. Save any changes in the editor, and go back to Filezilla, it will ask you do you want to upload the changes. Done!

Its not ideal, and goes against the proper development lifecycle you should be using, but will solve your problem immediately.
0
 
LVL 8

Expert Comment

by:Barry62
ID: 38320296
You can load php files into the same editor you load html files into.  Just don't touch anything inside <? ?>
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320302
Also, only edit the HTML. Avoid anything between <?php and ?> and <% and %> tags. Those contain PHP. The html should be recognisable for you.

Oh, ALWAYS ALWAYS back up before editing.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Barry62
ID: 38320324
PHP does not use <% %> tags.  That is ASP.
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320327
It does, they are called short tags. Search for them in php.ini. They are usually disabled by default but some devs enable to speed up coding...
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320333
Oops, my bad Barry, you are right. I meant <?. <% is indeed ASP and .Net
0
 

Author Comment

by:digisel
ID: 38320453
Thanks for your input
I have been using Ipswitch WP 12 for years.
Is there any reason I should not use this for the process you describe above??
0
 

Author Comment

by:digisel
ID: 38320464
could you please expand on your statement There is the (slightly dangerous) option....
why is it slightly dangerous if I keep a back-up copy of the original.
What are the pitfalls that I must avoid other than those you specify?

Please also explain your statement:

"Its not ideal, and goes against the proper development lifecycle you should be using, but will solve your problem immediately. "
I am not a programer but I do have a working knowledge of using Notepad++ and html coding.
~Thanks
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320467
Only that Filezilla provides this functionality, is free and opensource and is the best FTP program Ive used (IMO).

You could just as easily download the file via your own FTP program and upload it yourself as you see fit. Filezilla simply provides a simpler, more integarted, approach.  Ultimately, you should work with what you feel comfortable.
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320482
Slightly dangerous in that you are editing files and uploading them directly to the server without proper testing. This ties in with the development lifecycle I was referring. In an ideal world, you would have a development environment, with some form of Code repositoy to track changes to the code. A deployment process to send the code to a staging environment for testing, and then onto live server should that testing pass.

Its a lot of effort, but ultimately, editing files direclty on live like this with FTP isnt ideal. However, full setups like that arent for everybody. And on simpler sites this can work just fine.
0
 

Author Comment

by:digisel
ID: 38320522
I have copied over index.php through Ipwitch.
I opened the file in Notepad++
I could see the programing instrcutions but none of the text i.e. in the head and the Body which I need to edit.
Not sure where to go from here
0
 

Author Comment

by:digisel
ID: 38320563
hi slimshaneey
thanks for your clear, concise and complete answer to my queries.   that was very good if i may say so.   often experts provide very cryptic  answers working on the assumption that one knows more than one does.  thanks
0
 

Author Comment

by:digisel
ID: 38320567
did my post regarding the fact that there is no html code in the file get through??
Is it possible that the index.php file is making a call on the text (i.e. html) located elswewhere in either another file or another sub directory on the site??
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320607
Yeah, depending on how the site is built, you could find it is all content managed, meaning the code fetches all the display content from the database or other source, and outputs it that way. Or it could be built as an MVC (Model-View-Controller) site with a framework such as Cake, Zend or Symfony. In this case there will be view templates, and layout pages that contain the html. The framework would then generate all the html by combining those. Exlplaining how they work is probably beyond the scope of a Q/A system like this, its pretty indepth too. Best option is probably to ask your developer where the layout code for various pages you want to edit is.
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 38320651
Without really seeing your code in index.php, its hard to say how exactly your site works. I would be very careful about posting that code here though, just in case there are identifying details like IP address, database names and passwords etc.  If you arent sure, dont post anything!

Again, your best bet is to get the developer to spend 5-10 minutes talking you through the structure, and any code framworks (like Zend, CakePHP, Symfony,Codeigniter etc), that the website uses. As I say, its likely tha, if a framework is involved, that the html is located in template files (or partials) and layout files (the main core of the page like headers and footers that dont change often, templates are for the inner parts thats change every page)

S
0
 

Author Comment

by:digisel
ID: 38320963
thanks.   i shall take it up with the developer as you suggest.  one last query please.
the site does work off a series of templates.  there are probably 20 sub categories on the site.  can you sugest what sort of directories i might investigate to find the html code.  what should i be looking for?
thanks
0
 
LVL 11

Accepted Solution

by:
Slimshaneey earned 2000 total points
ID: 38321091
Again, that very much depends on the framework used, and without seeing the folder structure or file layout I would only be guessing. Wish I could help more!

An option would be to look at the html source for the the page you want to edit. Find the table/div id you want to edit. Not the actual content of the tables, but the structure.

You could then download the folder from the server and do a search to find matches for the partiucular table/div/css class, whatever, that you want and it may help you to understand how its all organised?
0
 

Author Closing Comment

by:digisel
ID: 38321428
thank you for very much for help and support.  I very much appreciate it.
best regards.   cheers
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question