{"id":126,"date":"2003-02-13T21:30:01","date_gmt":"2003-02-13T21:30:01","guid":{"rendered":"http:\/\/www.guyweb.co.uk\/?p=126"},"modified":"2003-02-13T21:30:01","modified_gmt":"2003-02-13T21:30:01","slug":"php-virtual-paths","status":"publish","type":"post","link":"https:\/\/guycarberry.co.uk\/guyweb\/2003\/02\/13\/php-virtual-paths\/","title":{"rendered":"PHP virtual paths&#8230;"},"content":{"rendered":"<p>&#8230;are a sodding mystery to me! I decided to make my life easier by using PHP included files to write the header, footer and other static stuff on the pages of this site. Was this a good idea? Well, in theory yes. Having the header and footer in separate files means I only have to update them once and the change is reflected across the site. However, for some reason, PHP include files do not let you use a virtual path. Consider this:<\/p>\n<p><code>&lt;? include(&quot;\/includes\/header.inc&quot;); ?&gt;<\/code><\/p>\n<p>This line of code uses a &#8216;virtual&#8217; path to the folder &#8216;includes&#8217; containing the file &#8216;header.inc&#8217;. The forward slash stands for the site root. This is useful because we don&#8217;t want to be having loads of relative URLs all over the place like:<\/p>\n<p><code>&lt;? include(&quot;..\/includes\/header.inc&quot;); ?&gt;<\/code><\/p>\n<p><code>&lt;? include(&quot;..\/..\/includes\/header.inc&quot;); ?&gt;<\/code><\/p>\n<p>etc. With most other web-related stuff you can use the virtual url system, just not with PHP. I&#8217;m trying to work out how to do this so I can get rid of the Dreamweaver template system that I&#8217;ve been using ever since my host lost all CGI ability (and therefore, Movable Type).<\/p>\n<p>Not being an expert in PHP, I tend to search the web for answers. This time I have drawn a blank. I&#8217;m hoping somebody will see this and <a href=\"\/guy\/contact.php\">get in touch<\/a>. Until I can solve this vexing riddle, you will get some very basic looking pages: <a href=\"\/pages\/join_the_list.php\">mailing list<\/a>, <a href=\"\/testbed\/css\/index.php\">css emporium<\/a> to name a few.<\/p>\n<p>**UPDATE** This started annoying me so much so that I&#8217;ve completely abandoned the Dreamweaver templates and hand coded the individual relative URLs on each page. I guess at some point I&#8217;ll work out how to do what I need to do. For now, as with much to do with this site over the last month, I will cope.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230;are a sodding mystery to me! I decided to make my life easier by using PHP included files to write the header, footer and other static stuff on the pages of this site. Was this a good idea? Well, in theory yes. Having the header and footer in separate files means I only have to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[40],"class_list":["post-126","post","type-post","status-publish","format-standard","hentry","category-life","tag-life"],"_links":{"self":[{"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/posts\/126"}],"collection":[{"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":0,"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"wp:attachment":[{"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guycarberry.co.uk\/guyweb\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}