Forum Moderators: coopster
I'm new to PHP and what I want to do is grab a local text file and make it a bit prettier in a web page.
Essentially the file will be various lines of text with some of the lines indented by a space. EG
Some text
indented text
more indented text
another line of text
and yet more indented text
The idea is that the non-indented text is highlighted (possibly just a bold font) and is visible by default, while the indented text is hidden until the non-indented line above is clicked (and vice-versa).
I know this probably takes me into the realms of DHTML etc so if I'm in the wrong place let me know.
Cheers
The way I see it as you read each line you need to recognize indented lines.
Starting with a space and comparing the first character of each line read from the file should be ok. I might look into using some other kind of token (character) though to make it more reliable. It all depends where the text files are written and how strict your rules are making sure that only the proper rows have starting spaces.
A simple if statement using maybe substr [ca.php.net] should work.