It sounds to me like you need to begin implementing what is known as "separation of concerns" across your application generally. The examples folks give about templating, in response to your specific complaint about page editors breaking your code, are important, but represent just one example of this tactic. As your program gets larger and more complex it becomes harder to modify and debug--even if your designer is not breaking your code.
Probably the most common separation is a three way split between data, logic and presentation as described in the design pattern Model-View-Controller (MVC). You do not need a full blown MVC framework in place to implement the same basic principles. The idea is simply to encapsulate code that deals with your data (model) in one place, the code that presents this data to the user (view) in another. You tie that code together with code that is only concerned with presenting the right data to the right user at a the right time (controller).
From your description, it sounds like you have right now is a Transaction Script pattern, where you have a php file "dothis.php" that is loaded in the browser, and all the function definitions and HTML for the display are together. You already have functions, so you are already beginning to encapsulate pieces of logic.
The way I would approach this would be, in keeping with the other answers here about templating, is to remove all of the HTML into another file only referencing simple PHP variables and maybe some loops (but as little conditional switching as you can). That will make the template easier to read and harder to break. When your page editor wants to modify the layout, give them THAT file.
You then separate all of your data access functions to another file, ideally creating a class (or several classes, depending on how complex your data is and how frequently you need to reuse it).
At this point your "dothis.php" has been stripped down to maybe some configuration code (which you can separate out to an include, and some authentication code (which you can separate out to its own class), and is only calling the data access functions, and calling the included template file. Your controller itself is therefore greatly simplified and easier to manage.