Show me some comments! Nov17 '04
The project
I thought it would be an interesting project to have PHP users show their comments for a specific blog page. After all, a good programmer always comments out their code, right?
Since a blog may contain numerous pages, it would be best to showcase just one page.
You pick it.
(By no means is this limited to PHP. That is just currently what I use to create dynamic web pages. Java, ASP, ColdFusion – all these are acceptable too.)
My PHP repository
I keep a couple of PHP pages outside of my web root directory, for security reasons. One of those files is called main.php, and I use it to store commonly used functions and global variables.
I would like to showcase my comments for main.php.
In no particular order, here they are:
# DECLARE MORE INTUITIVE VARIABLES FOR USE BELOW
# THIS FUNCTION’S ONLY PURPOSE IS FOR THE NAVIGATION TABS AT THE TOP OF THE PAGE.
# THIS IS NOT CONTROLLING INCLUDES, OR ANYTHING LIKE THAT.
# EACH CASE IS THE ACTUAL URL, IE: www.matthom.com/blog/ ... REMEMBER THE $url_array HOLDS THE FIRST WORD, AFTER www.matthom.com/
# IN THE SWITCH/CASE BELOW, WE ASSIGN A NUMBER TO EACH SCENARIO... THAT NUMBER CORRESPONDS TO ANOTHER ARRAY, $nav_items,
# WHICH PULLS OUT THE CORRECT NAV ITEM TITLE.
# THIS IS ALSO 2, BECAUSE WHEN YOU’RE IN AN ARCHIVE ENTRY PAGE, YOU STILL WANT THE ’BLOG’ TAB HIGHLIGHTED
# ARBITRARY NUMBER TO ALLOW ALL NAVIGATION TABS TO DISPLAY UN–HIGHLIGHTED, IF THE SECTION IS NOT ONE OF THE ABOVE
# NO FEEDBACK YET? AN APPROPRIATE STRING IS PRINTED, IN THOSE CASES
# IF YOU ARE ON A ’MAIN’ PAGE, LIKE THE BLOG MAIN PAGE, OR THE HEADLINES MAIN PAGE, YOU NEED THE URL TO THE ’ARCHIVED’ PAGE
# THE $url SHOULD JUST BE THE OPENING
<a>TAG.# OTHERWISE, WE JUST WANT TO PRINT THE STATEMENT, WITHOUT ANOTHER LINK – SINCE YOU CAN’T GO ANY FURTHER
# PHP DATE FORMATTING:
# GATHERS THE CURRENT DATE AND TIME INFORMATION, AND STORES THEM IN EASY TO USE VARIABLES
# NEXT TO EACH LINE IS THE OUTPUT
# TURN NEW LINES INTO
<p>TAGS – COURTESY OF PHOTOMATT: http://photomatt.net/scripts/autop# PERFORMS A SWITCH/CASE TO SELECT TO APPROPRIATE CRITERIA
# This function takes a table name as the parameter, and uses the query "DESCRIBE TABLE_NAME"
# It is usefeul for seeing the SQL layout or structure of a table.
# COLUMNS RETURNED: Field, Type, Null, Key, Default, Extra
# THIS IS A SIMPLE STRING REPLACE FUNCTION.
Now that you got the idea... show me some comments!
Categories: Projects
, Web Development ![]()
Add Feedback (view all)
Leave feedback
Excellent, Dale. Love it. It is more useful than you think. It inspires. ... Read more.
Ok, I admit it, I have NEVER commented any of my code. Not even my HTML. But, since I am a PHP late bloomer, I definitely know I'd better get my ac ... Read more.
Amanda, yes - losing code and forgetting what some code does is frustrating... can't wait to see your comments ... Read more.
// test to see if we are not on the homepage // if we are, then echo the welcome statement // categorical listing - only displays the ... Read more.
Like it, Chad. ... Read more.
I'm more of a C coder [switching constantly between game development and operating system development] These comments are old. They are from ... Read more.
UCosty, I like the personal comments - or "notes to self..." ... Read more.
matthom
is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from a suburb of Chicago.
Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.
Popular Pages
- Fast rounded corners in Photoshop (5683 recent visits)
- PHP – passing variables across pages (2086 recent visits)
- JavaScript set selected on load (1741 recent visits)
- Removing all child nodes from an element (1210 recent visits)
- iPod songs out of order? (1013 recent visits)
- Firefox 3 smart address bar: wildcard search (916 recent visits)
- Britney - Everytime piano tab (879 recent visits)
- MySQL LEFT JOIN syntax (731 recent visits)
- Breathe Me - Sia (661 recent visits)
- Tumblr: how blogging should be (549 recent visits)
Similar Entries
- ‘Comments you’ve made’ application (2 recent visits)
- Comments for file/folder names in OS X (0 recent visits)
- Search through comments activated (1 recent visits)
- Why blog comments are useless (2 recent visits)
- Leaving comments on other sites (1 recent visits)
- "Comments RSS" now available (1 recent visits)
Stats
0 unique visits since Nov17 '04
My current system has very few comments which is bad. Although the new thing should be much better. settings.php //remove ^ E_N ... Read more.