Parse text file on click and display
Posted
by
John R
on Pro Webmasters
See other posts from Pro Webmasters
or by John R
Published on 2012-06-10T16:41:17Z
Indexed on
2012/06/10
16:48 UTC
Read the original article
Hit count: 262
I am thinking of a methodology for rapid retrieval of code snippets.
I imagine an HTML table with a setup like this:
one two ... ten
one oneTwo() oneTen()
two twoOne() twoTen()
...
ten tenOne() tenTwo()
When a user clicks a function in this HTML table, a snippet of code is shown in another div tag or perhaps a popup window (I'm open to different solutions).
I want to maintain only one PHP file named utitlities.php that contains a class called 'util'. This file & class will hold all the functions referenced in the above table (it is also used on various projects and is functional code). A key idea is that I do not want to update the HTML documentation everytime I write/update a new function in utilities.php. I should be able to click a function in the table and have PHP open the utilities file, parse out the apropriate function and display it in an HTML window.
Questions:
1) I will be coding this in PHP and JavaScript but am wondering if similar scripts are available (for all or part) so I don't reinvent the wheel.
2) Quick & easy Ajax suggestions appreciated too (probably will use jquery, but am rusty).
3) Methodology for parsing out the functions from the utilities.php file (I'm not to good with regex).
© Pro Webmasters or respective owner