{"message":"%3Carticle%3E%0A%09%3Ch1%3EThis+is+an+example+on+how+to+use+Chinchilla%2C+a+RESTful+framework+in+PHP%3C%2Fh1%3E%0A%09%3Col%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3ECreate+a+resource+by+creating+a+file+in+the+resources+folder.+You+can+copy+either+ExampleResource.php+or+IndexResource.php.%3C%2Fp%3E%0A%09%09%3C%2Fli%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3ECreate+a+method+in+your+new+resource+named+the+same+as+the+HTTP+method+you+want+it+to+handle.+For+example%2C+if+you+look+at+the+ExampleResource.php+file%2C+you%27ll+see+a+method+called+%22get%22.+This+method+responds+to+an+HTTP+GET+request+to+a+relative+url+%22%2Fexample%22+%28NOTE%3A+you+can+specify+the+representation+with+file+extensions+like+.html%2C+.xml%2C+.json%2C+.js%2C+or+even+.phtml+for+partial+HTML%29.+If+you+want+to+handle+the+HTTP+POST+method%2C+then+create+a+method+called+%22post%22.%3C%2Fp%3E%0A%09%09%3C%2Fli%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3EYour+methods+will+almost+always+look+like+this%3A%3C%2Fp%3E%0A%09%09%09%3Cpre%3E%0A%09%09%09%09%3Ccode%3E%0A%09public+function+get%28%29%7B%0A%09%26%2309%3B%2F%2A+logic+here+%2A%2F%0A%09%26%2309%3B%24this-%3Etitle+%3D+%22An+example+using+Chinchilla%2C+A+RESTful+framework+in+PHP%22%3B%0A%09%26%2309%3B%24this-%3Eoutput+%3D+View%3A%3Arender%28%27example%2Findex%27%2C+%24this%29%3B%0A%09%26%2309%3Breturn+View%3A%3Arender_layout%28%27default%27%2C+%24this%29%3B%0A%09%7D%0A%09%09%09%09%3C%2Fcode%3E%0A%09%09%09%3C%2Fpre%3E%0A%09%09%3C%2Fli%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3EThe+static+View%3A%3Arender+method+will+look+in+%22views%2Fexample%2F%22+for+a+file+called+%22index_html.php%22.+The+framework+determines+the+file+type+%28eg.+html%2C+xml%2C+json%2C+rss%2C+atom%2C+etc.%29+based+on+the+url.+If+the+url+is+%22%2Fexample.html%22%2C+then+the+framework+will+set+the+resource%27s+fileType+property+to+%22html%22+and+View%3A%3Arender+will+return+the+views%2Fexample%2Findex_html.php+file+to+the+resource%27s+%22output%22+property.%3C%2Fp%3E%0A%09%09%3C%2Fli%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3EThe+return+call+in+the+function+above+render%27s+the+output+property+in+the+default+layout+which+resides+in+%22views%2Flayouts%2Fdefault_html.php%22%2C+where+the+%22_html%22+in+the+file+name+indicates+it%27s+representation+%28The+Re+in+REST%29.%3C%2Fp%3E%0A%09%09%3C%2Fli%3E%0A%09%09%3Cli%3E%0A%09%09%09%3Cp%3EYou%27ll+also+notice+a+themes+folder+in+the+file+hierarchy.+This+folder+contains+themes+that+you+might+want+to+use+for+your+site.+There%27s+a+%22default%22+theme+in+the+code+base+now+which+can+be+configured+by+returning+the+name+of+the+theme+folder+in+the+Settings%3A%3A%24theme+property.+If+the+%22views%22+folder+hierarchy+is+defined+in+a+theme+folder+within+the+%22themes%22+folder%2C+the+framework+will+look+there+first+to+find+any+views+it%27s+looking+for.+The+%22views%22+functionality+is+how+the+framework+implements+the+%22Representational%22+part+of+REST.+You+can+represent+the+data+in+any+way+by+creating+a+view+for+it%2C+according+to+the+file+type+you+specify.+For+instance%2C+if+I+want+to+represent+%22.doc%22+files%2C+I+would+create+view+files+appended+with+%22_doc.php%22.+Check+out+the+example+resource+and+views+to+see+what+I+mean.%3C%2Fp%3E%0A%09%09%3C%2Fli%3E%0A%09%3C%2Fol%3E%0A%3C%2Farticle%3E"}
