<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Load Your Static Content the Dynamic&#160;Way</title> <atom:link href="http://davidwalsh.name/load-static-content-dynamic/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/load-static-content-dynamic</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 04:02:29 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: rodger</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-8370</link> <dc:creator>rodger</dc:creator> <pubDate>Mon, 23 Mar 2009 11:21:00 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-8370</guid> <description>On each environment you have a different config file. I would NOT do it based on the URL, bc that is not reliable and can also be faked.</description> <content:encoded><![CDATA[<p>On each environment you have a different config file. I would NOT do it based on the URL, bc that is not reliable and can also be faked.</p> ]]></content:encoded> </item> <item><title>By: Jeremy Martin</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-736</link> <dc:creator>Jeremy Martin</dc:creator> <pubDate>Fri, 18 Apr 2008 16:52:04 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-736</guid> <description>@Jay
Using a config file certainly is a nice solution - and likely better in some cases.  However, I intended this particular approach to be as simple as possible for small-scale sites.Beyond simplicity, though, I find that a function actually does have some advantages when it comes to referencing static content.  For example, if you&#039;re serving HUGE amounts of content, you can&#039;t (easily) implement load balancing through a config file, whereas it is simple in a function.  And if a developer ever did want to &quot;upgrade&quot; to using an external config file, the value can just as easily be accessed from the function as well (albeit an extra step in that case).</description> <content:encoded><![CDATA[<p>@Jay<br
/> Using a config file certainly is a nice solution &#8211; and likely better in some cases.  However, I intended this particular approach to be as simple as possible for small-scale sites.</p><p>Beyond simplicity, though, I find that a function actually does have some advantages when it comes to referencing static content.  For example, if you&#8217;re serving HUGE amounts of content, you can&#8217;t (easily) implement load balancing through a config file, whereas it is simple in a function.  And if a developer ever did want to &#8220;upgrade&#8221; to using an external config file, the value can just as easily be accessed from the function as well (albeit an extra step in that case).</p> ]]></content:encoded> </item> <item><title>By: Jay</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-734</link> <dc:creator>Jay</dc:creator> <pubDate>Fri, 18 Apr 2008 14:59:47 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-734</guid> <description>Hmm, I love your blog. I think you&#039;re definately more on the creative/design side than you are on the technical/development side, am I correct?I say that bc what you&#039;re talking ab is deploying to different environments. This is a common problem. You don&#039;t want to mess with hardcoding that in a php file. That is an old school way of doing it. It&#039;s best practice to put configuration settings in a configuration txt file, tho technically you could still put it in a php file if you really want to. On each environment you have a different config file. I would NOT do it based on the URL, bc that is not reliable and can also be faked.Now for the poor man&#039;s deployment you can just keep different copies of the config in a folder and call them conf-prod.txt, conf-dev.txt, conf-local.txt, etc and copy over the one you need as conf.txt on the server or locally.What I do is I use source control, CVS or SVN and use a deployment script to do deployment for me. This is more advanced than some like to get, tho I don&#039;t think they&#039;re too bad once you get the hang of it. I know rails has it&#039;s own deployment thing built in, but I could never find one for PHP. I think most ppl code their own, like myself. Anyways I switched over to that this past year and it&#039;s so much better.Anyways you&#039;re on the right track. I always use absolute URLs for my image paths and links bc it just causes less problems I think. I always have a config settings called web_url and static_url and I prepend that anywhere I have links. I also use code igniter for custom development which abstracts some of that.</description> <content:encoded><![CDATA[<p>Hmm, I love your blog. I think you&#8217;re definately more on the creative/design side than you are on the technical/development side, am I correct?</p><p>I say that bc what you&#8217;re talking ab is deploying to different environments. This is a common problem. You don&#8217;t want to mess with hardcoding that in a php file. That is an old school way of doing it. It&#8217;s best practice to put configuration settings in a configuration txt file, tho technically you could still put it in a php file if you really want to. On each environment you have a different config file. I would NOT do it based on the URL, bc that is not reliable and can also be faked.</p><p>Now for the poor man&#8217;s deployment you can just keep different copies of the config in a folder and call them conf-prod.txt, conf-dev.txt, conf-local.txt, etc and copy over the one you need as conf.txt on the server or locally.</p><p>What I do is I use source control, CVS or SVN and use a deployment script to do deployment for me. This is more advanced than some like to get, tho I don&#8217;t think they&#8217;re too bad once you get the hang of it. I know rails has it&#8217;s own deployment thing built in, but I could never find one for PHP. I think most ppl code their own, like myself. Anyways I switched over to that this past year and it&#8217;s so much better.</p><p>Anyways you&#8217;re on the right track. I always use absolute URLs for my image paths and links bc it just causes less problems I think. I always have a config settings called web_url and static_url and I prepend that anywhere I have links. I also use code igniter for custom development which abstracts some of that.</p> ]]></content:encoded> </item> <item><title>By: Mike Greenberg</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-714</link> <dc:creator>Mike Greenberg</dc:creator> <pubDate>Fri, 18 Apr 2008 03:24:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-714</guid> <description>I&#039;m not much of a coder, so to me this is pure genius.This has got to be one of the most useful blogs, for me at least.</description> <content:encoded><![CDATA[<p>I&#8217;m not much of a coder, so to me this is pure genius.</p><p>This has got to be one of the most useful blogs, for me at least.</p> ]]></content:encoded> </item> <item><title>By: david</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-706</link> <dc:creator>david</dc:creator> <pubDate>Thu, 17 Apr 2008 18:08:56 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-706</guid> <description>@Jesus:  I think the reason for this is because if a person doesn&#039;t have internet access but they still want to work in their development environment, they can&#039;t use absolute paths to the remote location.  Instead, they pull the file from localhost.I do this with my laptop when I don&#039;t have internet access.</description> <content:encoded><![CDATA[<p>@Jesus:  I think the reason for this is because if a person doesn&#8217;t have internet access but they still want to work in their development environment, they can&#8217;t use absolute paths to the remote location.  Instead, they pull the file from localhost.</p><p>I do this with my laptop when I don&#8217;t have internet access.</p> ]]></content:encoded> </item> <item><title>By: Jesus DeLaTorre</title><link>http://davidwalsh.name/load-static-content-dynamic#comment-705</link> <dc:creator>Jesus DeLaTorre</dc:creator> <pubDate>Thu, 17 Apr 2008 17:58:49 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=230#comment-705</guid> <description>Sorry I don&#039;t seem to understand something. What is the point of the get_static_root() function if the absolute path will get resolved correctly?</description> <content:encoded><![CDATA[<p>Sorry I don&#8217;t seem to understand something. What is the point of the get_static_root() function if the absolute path will get resolved correctly?</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.016 seconds using disk: basic
Object Caching 569/569 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 05:30:12 -->
