{"id":10729,"date":"2014-11-22T05:04:26","date_gmt":"2014-11-21T18:04:26","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=10729"},"modified":"2014-11-22T05:04:26","modified_gmt":"2014-11-21T18:04:26","slug":"php-nested-elements-report-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-nested-elements-report-primer-tutorial\/","title":{"rendered":"PHP Nested Elements Report Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tags_within.php\"><img decoding=\"async\" id='qxmximgjoptionpane'  style=\"float:left; border: 15px solid pink;\" alt=\"PHP Nested Elements Report Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tags_within.jpg\" title=\"PHP Nested Elements Report Primer Tutorial\" id=\"pnerpt\" onmouseover=\" this.src=this.src.replace('.jpg','.GIF').replace('.png','.jpg').replace('.gif','.png').replace('.GIF','.gif');     \"  \/><\/a><p class=\"wp-caption-text\">PHP Nested Elements Report Primer Tutorial<\/p><\/div>\n<p>Lots of data is hierarchical by nature.   Examples are HTML or XML or JSON data, and to get a report on tag types nested within other tag types can be a useful tool to sanity check that your data is well structured, or is valid, perhaps.<\/p>\n<p>Because our input is a data file today (ie. implicitly, a URL amounts to a data file, somewhere, on a web server), we will need a server side language to work the functionality, though I daresay, <a target=_blank title='Ajax information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Ajax_%28programming%29'>Ajax<\/a> techniques may be okay to use too, because we are not writing files, as such, here, today, but just reporting on files &#8230; subtle difference, but important, because Ajax techniques can read file data, but cannot write to files &#8230; the writing to files (on the <a target=_blank title='Web sever information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Web_server'>web server<\/a>) is where PHP (or ASP.Net) or other server side languages really need to be used.<\/p>\n<p>With XML data in particular, data element <i>attributes<\/i> are often used as a place to contain important business logic that affects the structure of your data, so, here, with our PHP, we allow a simple arrangement, where if you can specify a unique <i>attribute<\/i> search string, then you can narrow down the parent tag scope of interest, to those only containing this <i>attribute<\/i> search string &#8230; and I guess you could <i>kludge<\/i> this for HTML data, perhaps with a unique <i>classname<\/i> or <i>id<\/i> or <i>style= property<\/i> perhaps.<\/p>\n<p>You are welcome trying it here with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tags_within.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<p>Here is a tailored call of the PHP that matches what is on today&#8217;s tutorial&#8217;s picture as a <a target=_blank title='Google live run' href='http:\/\/www.rjmprogramming.com.au\/PHP\/tags_within.php?url=http%3A%2F%2Fwww.google.com&#038;ptag=form&#038;ctag=input&#038;attrib=&#038;start=%3C&#038;end=%3C%2F&#038;submit=Report'>live run<\/a> you can try to search the Google search engine landing webpage&#8217;s <i>input<\/i> tags nested within <i>form<\/i> tags, as an example of things you can try &#8230; hope it can be of interest, or help.<\/p>\n<p>You can download PHP programming source code and rename to <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tags_within.php_GETME\" title='tags_within.php'>tags_within.php<\/a> here.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d10729' onclick='var dv=document.getElementById(\"d10729\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=hierarchy\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d10729' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Lots of data is hierarchical by nature. Examples are HTML or XML or JSON data, and to get a report on tag types nested within other tag types can be a useful tool to sanity check that your data is &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-nested-elements-report-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[69,418,513,564,576,664,932,997,1240,1319,1345,1411,1480],"class_list":["post-10729","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-ajax","tag-file","tag-google","tag-hierarchy","tag-html","tag-json","tag-php","tag-programming","tag-tag","tag-tutorial","tag-url","tag-web-server","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10729"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=10729"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/10729\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=10729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=10729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=10729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}