{"id":34278,"date":"2023-03-04T01:24:20","date_gmt":"2023-03-03T19:54:20","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/"},"modified":"2023-03-04T01:24:20","modified_gmt":"2023-03-03T19:54:20","slug":"solved-need-help-linking-2k-files-into-html-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/","title":{"rendered":"[Solved] Need help linking 2k files into html [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-27074001\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"27074001\" data-parentid=\"27073133\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Given your specific situation as explained in the chat, <\/p>\n<ul>\n<li>you have no access to the &#8216;back end&#8217;<\/li>\n<li>you DO have access and permission to change the directory-structure and file-names of the course-materials (pdf-files)<\/li>\n<li>current path &amp; filenaming conventions are a mess (don&#8217;t exist) and unpredictable<\/li>\n<li>there is currently nothing linking course-codes with course-descriptions\/course-materials<\/li>\n<li><em>every<\/em> course has 20 course-materials (pdf-files):\n<ul>\n<li>5 study sheets<\/li>\n<li>5 study sheet answers<\/li>\n<li>5 graded assignments<\/li>\n<li>5 grades assignment answers<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Alas, somewhere something <em>has<\/em> to be done (especially for future lazy maintainability).<br \/>\nBefore things grow further out of hand I&#8217;d suggest to start by implementing a file-path\/file-naming convention. This should also help assist in creating future other solutions then the one I&#8217;m suggesting to start with.<\/p>\n<p>The main point (and current flaw) is the lack of any automatable relations\/predictability!<\/p>\n<p>First restructure your file-paths\/file-names:<br \/>\nlet&#8217;s make a folder we shall consider as root for the course-materials: <code>courses\/<\/code>.<\/p>\n<p>Inside course we create your main categories:<\/p>\n<pre>\ncourses\/math\/        \ncourses\/english\/        \ncourses\/science\/       \ncourses\/social science\/       \ncourses\/electives\/        \n<\/pre>\n<p>Now for every course-category (eg: course\/math\/, course\/english, etc.), you create folders (or copy the existing folders) and (re-)name them to the course-number:<\/p>\n<pre>\ncourses\/math\/HS-ES-103\/\ncourses\/math\/HS-ES-104\/\netc...\ncourses\/english\/HS-ES-113\/ \ncourses\/english\/HS-ES-114\/ \netc...\n<\/pre>\n<p>Now, in every course (e.g. courses\/math\/HS-ES-103, courses\/english\/HS-ES-113) you create (or rename respectively) 4 folders: <\/p>\n<pre>\ncourses\/category\/course-number\/ssu\/\ncourses\/category\/course-number\/ssa\/\ncourses\/category\/course-number\/gau\/\ncourses\/category\/course-number\/gaa\/ \n<\/pre>\n<p>to contain the course-materials (pdf-files).<br \/>\nThese should hold the course&#8217;s respective pdf-files.<br \/>\nAlso, in every course (next to the 4 folders) you create a file containing the course&#8217;s meta-data:         <\/p>\n<ul>\n<li>Course Title (like: &#8216;ENGLISH 9 Common Core Semester 2&#8217;)<\/li>\n<li>Grade Level<\/li>\n<li>Course Materials<\/li>\n<li>Course Description<\/li>\n<\/ul>\n<p>This could be in xml, json, csv, txt&#8230; what ever you find simplest to parse from php.<br \/><strong>Note:<\/strong> there is an added bonus to this as some simple description (preferably highly human readable) inside that folder-structure never hurts in the future&#8230;<\/p>\n<p>Now, creating courses\/category by hand is going to be faster then creating a script to do it.<br \/>\nThe most of the work will be in creating (and moving relevant course-files) or renaming the course-code folders and adding the meta-data-info-file.<\/p>\n<p>Finally the filenames must be alphabetically sortable in the correct order.<br \/><code>unpredictable_string_1.pdf<\/code> is fine. <code>two_unpredictable_string.pdf<\/code> is not.<\/p>\n<p>If there are folders that have <code>unpredictable_string_[one|two|three|four|five].pdf<\/code> you could clear them up using a commandline-script that replaces one, two, three, four and five with their respective numbers (1,2,3,4,5) in the filenames <code>unpredictable_string_[1|2|3|4|5].pdf<\/code>.  <\/p>\n<p>From here on it is easy to go one of two ways:<\/p>\n<ul>\n<li>Rename the (sorted) file-names into predictable strings (so you don&#8217;t need to pass them to your html\/json\/php etc (you can once again do that using a simple command-line script).<\/li>\n<li>Don&#8217;t rename the unpredictable file-names and make your directory-parsing script read out the actual file-names (I wouldn&#8217;t recommend this).<\/li>\n<\/ul>\n<p>EXAMPLE final structure:<\/p>\n<pre>\n&gt; dir courses\/math\/HS-ES-103\/\ncourses\/math\/HS-ES-103\/ssu\/\ncourses\/math\/HS-ES-103\/ssa\/\ncourses\/math\/HS-ES-103\/gau\/\ncourses\/math\/HS-ES-103\/gaa\/ \ncourses\/math\/HS-ES-103\/info.txt  (json\/csv\/xml etc.) \n\n&gt; dir courses\/math\/HS-ES-103\/ssu\ncourses\/math\/HS-ES-103\/ssu\/HS-ES-103_ssu_1.pdf\ncourses\/math\/HS-ES-103\/ssu\/HS-ES-103_ssu_2.pdf\ncourses\/math\/HS-ES-103\/ssu\/HS-ES-103_ssu_3.pdf\ncourses\/math\/HS-ES-103\/ssu\/HS-ES-103_ssu_4.pdf\ncourses\/math\/HS-ES-103\/ssu\/HS-ES-103_ssu_5.pdf\n<\/pre>\n<p>Now that you have fixed your directory-structure it is a relative breeze to parse out any information and relations using for example PHP.<\/p>\n<p>Now you could use PHP to build static pages dynamically from a template or have it create one (or one per category) json-files (or xml, csv, etc..) to pass to the browser..         <\/p>\n<p><strong>It is important to note that it is NOT the idea to parse your whole directory-tree upon each and every page-request<\/strong>.<br \/>\nIt would be better to have a hidden admin-page containing a function to auto-update the stored cache after an update. Alternatively you could auto-update once every 24 hours (using a common template loop that checks the cache-page\/file&#8217;s time-stamp and if older then x amount of time, reruns the updater script).<\/p>\n<p>Search SO for examples of parsing directories, files(csv\/json etc) and caching a page.<\/p>\n<p>Good luck with your project!<\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\"><\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Need help linking 2k files into html [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Given your specific situation as explained in the chat, you have no access to the &#8216;back end&#8217; you DO have access and permission to change the directory-structure and file-names of the course-materials (pdf-files) current path &amp; filenaming conventions are a mess (don&#8217;t exist) and unpredictable there is currently nothing linking course-codes with course-descriptions\/course-materials every &#8230; <a title=\"[Solved] Need help linking 2k files into html [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/\" aria-label=\"More on [Solved] Need help linking 2k files into html [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[346,333,388,356,339],"class_list":["post-34278","post","type-post","status-publish","format-standard","hentry","category-solved","tag-html","tag-javascript","tag-jquery","tag-json","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] Need help linking 2k files into html [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Need help linking 2k files into html [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Given your specific situation as explained in the chat, you have no access to the &#8216;back end&#8217; you DO have access and permission to change the directory-structure and file-names of the course-materials (pdf-files) current path &amp; filenaming conventions are a mess (don&#8217;t exist) and unpredictable there is currently nothing linking course-codes with course-descriptions\/course-materials every ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-03T19:54:20+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Need help linking 2k files into html [closed]\",\"datePublished\":\"2023-03-03T19:54:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/\"},\"wordCount\":604,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"html\",\"javascript\",\"jquery\",\"json\",\"php\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/\",\"name\":\"[Solved] Need help linking 2k files into html [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2023-03-03T19:54:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-need-help-linking-2k-files-into-html-closed\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Need help linking 2k files into html [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Need help linking 2k files into html [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Need help linking 2k files into html [closed] - JassWeb","og_description":"[ad_1] Given your specific situation as explained in the chat, you have no access to the &#8216;back end&#8217; you DO have access and permission to change the directory-structure and file-names of the course-materials (pdf-files) current path &amp; filenaming conventions are a mess (don&#8217;t exist) and unpredictable there is currently nothing linking course-codes with course-descriptions\/course-materials every ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/","og_site_name":"JassWeb","article_published_time":"2023-03-03T19:54:20+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Need help linking 2k files into html [closed]","datePublished":"2023-03-03T19:54:20+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/"},"wordCount":604,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["html","javascript","jquery","json","php"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/","name":"[Solved] Need help linking 2k files into html [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2023-03-03T19:54:20+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-need-help-linking-2k-files-into-html-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Need help linking 2k files into html [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777008400","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/34278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=34278"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/34278\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=34278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=34278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=34278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}