PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a problem with some code I'm working on. When the XHTML in a gallery project I have been working on became too complex, I decided that I should start again, but this time with an HTML writer class. What I want to achieve is automatic indentation and a memory of it every time a new tag is opened. I think I can do this by incrementing every time an open function is called and decrementing every time a close function is called.
Here is the problem, I don't know how to create blank spaces which are dependent on an integer. (int = 1, 1 space etc). Does anyone know how I might go about this? (or any better ideas to what I'm trying to do)
I've managed to solve the problem by having a class variable initiated when the class is created. This is set to 0. Then a new tag is opened it is incremented, all tags will insert spaces and have the tag content appended to this string, when tags are closed, it is decremented