iwato Posted October 17, 2010 Share Posted October 17, 2010 BACKGROUND: Recently I learned how to create a dynamic table using a file include, an echo statement filled with CSS code, and a function with an id parameter. What is missing is a way to identify the included file without having it appear in the browser window. For the moment all I have is a nearly barren file with a .php extension.QUESTION: What is standard protocol for identifying and describing included files? <?php echo( '<style type="text/css"> div.table { margin-left:auto; margin-righ:auto; width:80%; } table#standard th { vertical-align:top; text-align:right; padding-right:2em; }</style>'); function create_Table($array, $id = '') { echo '<div class=\'table\'><table id=\'' . $id . '\'>'; foreach ($array as $key => $value) { if (is_string($value)) { echo '<tr><th>' . $key . '</th><td>' . $value . '</td></tr>'; } else { list($param_key, $param_value) = each($value); echo '<tr><th>' . $key . '</th><td>' . $param_key . ': ' . $param_value . '</td></tr>'; while (list($param_key, $param_value) = each($value)) { echo '<tr><th></th><td>' . $param_key . ': ' . $param_value . '</td></tr>'; } } } echo '</table></div>'; }?> Roddy Link to comment Share on other sites More sharing options...
justsomeguy Posted October 17, 2010 Share Posted October 17, 2010 What do you mean? Are you talking about metadata about the file? Link to comment Share on other sites More sharing options...
iwato Posted October 17, 2010 Author Share Posted October 17, 2010 What do you mean? Are you talking about metadata about the file?Exactly!Roddy Link to comment Share on other sites More sharing options...
justsomeguy Posted October 17, 2010 Share Posted October 17, 2010 PHP doesn't offer any metadata about the file other than what the OS supports. That just includes things like size, modified date, etc. The stat function will get that data:http://www.php.net/manual/en/function.stat.php Link to comment Share on other sites More sharing options...
iwato Posted October 18, 2010 Author Share Posted October 18, 2010 Thank you for responding. PHP doesn't offer any metadata about the file other than what the OS supports.I am not seeking to gather information about a file; rather I am interested in the proper way to supply information to a file -- namely, the sort of things that normally includes in metadata such as document title, author, description, etc.Is this simply entered through PHP comment? If so, is there a standard approach to doing so? If not, what you suggest and why?Roddy Link to comment Share on other sites More sharing options...
justsomeguy Posted October 18, 2010 Share Posted October 18, 2010 Regardless of the language, information like that is given in comments. There are several tools that will automatically generate documentation based on comments, so if you want to follow any particular convention instead of whatever makes the most sense to you, something like PHPDoc would give examples for adding comments to automatically produce documentation:http://manual.phpdoc.org/HTMLSmartyConvert...kstart.pkg.html Link to comment Share on other sites More sharing options...
iwato Posted October 18, 2010 Author Share Posted October 18, 2010 Regardless of the language, information like that is given in comments. There are several tools that will automatically generate documentation based on comments, so if you want to follow any particular convention instead of whatever makes the most sense to you, something like PHPDoc would give examples for adding comments to automatically produce documentation:http://manual.phpdoc.org/HTMLSmartyConvert...kstart.pkg.html Thanks!For the moment I happy to have learned what a DocBlock is.It should be enough to get me started in the right direction.Roddy Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.