<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>red conservatory</title>
	<atom:link href="http://redconservatory.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://redconservatory.com/blog</link>
	<description>nicole chung</description>
	<lastBuildDate>Wed, 16 May 2012 14:37:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Concrete5: Prefilling form fields with User Information</title>
		<link>http://redconservatory.com/blog/concrete5-prefilling-form-fields-with-user-information/</link>
		<comments>http://redconservatory.com/blog/concrete5-prefilling-form-fields-with-user-information/#comments</comments>
		<pubDate>Wed, 16 May 2012 14:19:11 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1565</guid>
		<description><![CDATA[Registration: setting up Custom User Attributes You can add your own custom attributes (for example, name and address) to a user. First you have to turn on Public Registration (it&#8217;s off by default) Dashboard &#62; System and Settings &#62; Login and Registration &#62; Public Registration Under &#8220;Allow Visitors to Signup as Members&#8221; select &#8220;On &#8211; [...]]]></description>
			<content:encoded><![CDATA[<h3>Registration: setting up Custom User Attributes</h3>
<p>You can add your own custom attributes (for example, name and address) to a user.</p>
<p>First you have to turn on <strong>Public Registration</strong> (it&#8217;s off by default)</p>
<p><code>Dashboard &gt; System and Settings &gt; Login and Registration &gt; Public Registration</code></p>
<p>Under &#8220;<strong>Allow Visitors to Signup as Members</strong>&#8221; select &#8220;On &#8211; email validation&#8221; (You can choose the other options but this one has been recommend to me, so this is the one I chose).</p>
<p>Then</p>
<p><code>Dashboard &gt; Members &gt; Attributes</code></p>
<p>Select or create new attributes and then check &#8220;<strong>Show on Registration Form</strong>&#8220;.</p>
<p><a href="http://redconservatory.com/blog/wp-content/uploads/2012/05/attributes.png"><img class="alignnone size-full wp-image-1566" title="attributes" src="http://redconservatory.com/blog/wp-content/uploads/2012/05/attributes.png" alt="" width="431" height="561" /></a></p>
<p>Checking this box tells Concrete5 to put this on the registration form. Specifically, in the file:</p>
<p><code>concrete/controllers/register.php</code> </p>
<p>- under the methond named do_register():</p>
<p><code>$aks = UserAttributeKey::getRegistrationList();</code></p>
<p><strong>getRegistrationList()</strong> gets all of the attributes which have &#8220;Show on Registration Form&#8221; checked. If the user filled out that field, then it gets added as a User Attribute.</p>
<p>There are a few posts on how to make a custom registration page so I won&#8217;t go into detail about that.</p>
<h3>The Form Part</h3>
<p>The simplest thing to do is create a single page that will hold your form, then use a bit of Javascript and PHP to &#8220;<strong>pre-fill</strong>&#8221; the fields with your User Attributes.</p>
<p>Under the controllers folder (your <strong>controllers</strong> folder, not the <strong>concrete/controllers</strong> folder) create a file called sample.php.This is your controller file.</p>
<p>Under the single_pages folder create a file called sample.php. This is your <strong>view</strong> file.</p>
<p>Then go to the Dashboard &gt; Pages and Themes &gt; Single Pages and create a file called <strong>sample.</strong></p>
<p><a href="http://redconservatory.com/blog/wp-content/uploads/2012/05/sample.png"><img class="alignnone size-full wp-image-1567" title="sample" src="http://redconservatory.com/blog/wp-content/uploads/2012/05/sample.png" alt="" width="712" height="177" /></a></p>
<p>&nbsp;</p>
<p>Single pages usually default to <strong>view.php</strong>, and any content you place in say, single_pages/sample.php will show up where you place:</p>
<p><code>&lt;?php<br />
print $innerContent;<br />
?&gt;</code></p>
<p>This bit of code goes into your view.php file (in your theme folder) where you want to place the content from your view (in your single_pages folder&#8230;in this case, the file called sample.php which is in the single_pages folder).</p>
<p><strong>Alternately</strong>, you can create a template with the same name as the controller and view (in this case, sample.php) drop that file into your theme folder, and that will work too (instead of using view.php). This gives you the chance to customize the look and feel a bit more.</p>
<h3>The Form Block</h3>
<p>Go to Dashboard &gt; Sitemap and find your page (sample).</p>
<p>Go to view the page and add a form block.</p>
<p>Add some questions to the block and then click &#8220;Add&#8221;. Once you are done, view the HTML source of the form.</p>
<p>Your inputs will look like:</p>
<p><code>&lt;input type="text" name="QuestionNumber" value=""&gt;</code></p>
<p>Where I wrote &#8220;QuestionNumber&#8221; it&#8217;s usually a number like &#8220;Question24&#8243; or &#8220;Question8&#8243;. Write these down for the inputs you want to pre-fill.</p>
<h3>The Controller</h3>
<p><script src="https://gist.github.com/2710684.js?file=controller-attributes-sample.php"></script></p>
<h3>The View</h3>
<p><script src="https://gist.github.com/2710728.js?file=gistfile1.js"></script></p>
<p>Remember, &#8220;special thing&#8221; gets passed to the view from the controller by:<br />
<code>$this->set('special_thing', $special_thing);</code></p>
<h3>To see the result</h3>
<p>To see the result, if you have permalinks turned on, you can go to sample/form/ to see how it works. If it&#8217;s not working, view your source to see if the javascript is getting the values from your controller file.</p>
<p>Pros<br />
Easier than trying to override the form block.</p>
<p>Cons:<br />
Uses Javascript. However, since this only pre-fills the form out for the user, it doesn&#8217;t actually prevent the user from using the form (they just have to type in more information without javacript turned on).</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete5-prefilling-form-fields-with-user-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concrete 5: Themes, javascript and css</title>
		<link>http://redconservatory.com/blog/concrete-5-themes-javascript-and-css/</link>
		<comments>http://redconservatory.com/blog/concrete-5-themes-javascript-and-css/#comments</comments>
		<pubDate>Tue, 08 May 2012 17:18:18 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1561</guid>
		<description><![CDATA[The following line will give you the path to your theme: &#60;?php $this-&#62;getThemePath(); ?&#62; And this line will give you the link to your stylesheet (in this case, &#8220;typography.css&#8221;): &#60;?php $this-&#62;getStyleSheet('typography.css'); ?&#62; Linking to javascript, images or other files inside of your theme folder is as simple as using echo: &#60;script type="text/javascript" src="&#60;?php echo $this-&#62;getThemePath(); ?&#62;js/jquery.min.js"&#62;&#60;/script&#62;  [...]]]></description>
			<content:encoded><![CDATA[<p>The following line will give you the path to your theme:</p>
<p><code>&lt;?php $this-&gt;getThemePath(); ?&gt;</code></p>
<p>And this line will give you the link to your stylesheet (in this case, &#8220;typography.css&#8221;):</p>
<p><code>&lt;?php $this-&gt;getStyleSheet('typography.css'); ?&gt;</code></p>
<p>Linking to javascript, images or other files inside of your theme folder is as simple as using <strong>echo</strong>:</p>
<p><code>&lt;script type="text/javascript" src="&lt;?php echo $this-&gt;getThemePath(); ?&gt;js/jquery.min.js"&gt;&lt;/script&gt; </code></p>
<p>Keep in mind that concrete5 controls the following when you write:</p>
<p><code>&lt;?php Loader::element('header_required'); ?&gt;</code></p>
<p>Elements controlled by concrete5:</p>
<p>- favicon</p>
<p>- apple icon</p>
<p>- the title tag and it&#8217;s content</p>
<p>- jQuery</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete-5-themes-javascript-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concrete 5 Setup: a checklist</title>
		<link>http://redconservatory.com/blog/concrete-5-setup-a-checklist/</link>
		<comments>http://redconservatory.com/blog/concrete-5-setup-a-checklist/#comments</comments>
		<pubDate>Tue, 01 May 2012 19:44:03 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1551</guid>
		<description><![CDATA[Below is a work-in-progress checklist of things I do when setting up a Concrete5 site. Upload a zip file and then SSH to unzip The unzipped files for Concrete5 clock in at around 31MB which is a super-big upload, so it&#8217;s easier to just upload the zip file and SSH to the site to unzip [...]]]></description>
			<content:encoded><![CDATA[<p>Below is a work-in-progress checklist of things I do when setting up a Concrete5 site.</p>
<h2>Upload a zip file and then SSH to unzip</h2>
<p>The unzipped files for Concrete5 clock in at around 31MB which is a super-big upload, so it&#8217;s easier to just upload the zip file and SSH to the site to unzip it:</p>
<p><code>unzip concrete-5-zip-filename-here.zip</code></p>
<h2>Enable Pretty URLs</h2>
<p>Dashboard &gt; System and Settings &gt; SEO And Statistics &gt; Enable Pretty URLS</p>
<h2>Remove the Concrete5 background images</h2>
<p>The Dashboard has background images which are pulled from the Concrete5 site. I personally don&#8217;t mind how these images look, however, if you are working locally off your computer it can be a bit of a pain if your internet access goes down (because Concrete5 will keep trying to get the images from the Concrete5 site).</p>
<p>Dashboard &gt; System and Settings &gt; Interface Preferences</p>
<p>Then:</p>
<p>Background image &gt; set to none.</p>
<p>I like to disable the Quick Navigation Bar because I find the way it appears when I hover over the Navigation bar a bit hard to manage.</p>
<h2>Set Permissions to Advanced</h2>
<p>Config &gt; site.php</p>
<p><code>&lt;?php define('PERMISSIONS_MODEL', 'advanced'); ?&gt;</code></p>
<p>So far, to me it seems easiest to set Permissions by &#8220;Page Type Defaults&#8221;. Then, under each Page Type Default, I set it &#8220;Manually&#8221;. There&#8217;s probably a better way to this however.</p>
<h2>Set the config file to 644</h2>
<p>The site.php file contains your database information, so to make it more secure set the file to 644 (usually it&#8217;s set to this after installation, so this is more of a check).</p>
<h2>Turn off Design mode for selected users</h2>
<p>Go to Config &gt; then select or create a file called site_process.php.</p>
<p>Say you have a group called, well, &#8220;Awful Designers&#8221; that you would like to not have Design mode:</p>
<p><code>&lt;?php<br />
$user = new User();<br />
$group = Group::getByName('Awful Designers');<br />
if($user-&gt;inGroup($group)) {<br />
define('ENABLE_CUSTOM_DESIGN', false);<br />
}<br />
?&gt;</code></p>
<h2>Turn on Maintenance Mode until the site is live</h2>
<p>This hides everything except for the front page unless someone is a user and logged into the site.</p>
<p><code>Dashboard &gt; System and Settings &gt; Permissions and Access &gt; Maintenance Mode</code></p>
<p>Note: I have had issues with maintenance mode. For example, I can&#8217;t seem to add custom attributes to a page when a site is in maintenance mode. If you are having problems like this, it&#8217;s probably because maintenance mode is on.</p>
<h2>Turn off Caching until the site is live</h2>
<p><code>Dashboard &gt; System and Settings &gt; Cache and Speed settings &gt; Basic Cache &gt; Off</code></p>
<p>When you are developing your site, you sometimes won&#8217;t see your changes due to the Basic Cache being on. Turning this off during development will help you with this issue.</p>
<h2>Turn off &#8220;Checking for updates&#8221;</h2>
<p>Add the following to your config &gt; site.php file:</p>
<p><code>define('ENABLE_NEWSFLOW_OVERLAY', false);<br />
define('ENABLE_APP_NEWS', false);<br />
define('WHITE_LABEL_DASHBOARD_BACKGROUND_FEED', false);</code></p>
<p>This turns off &#8220;checking for updates&#8221; and also any news items (the news that pops up when you log in). Even if you are working from a local server, Concrete5 will (if you don&#8217;t add this) keep checking the concrete5.org site for news and updates, which can be a bit of a hassle.</p>
<p>For further reference, refer to the <a href="http://www.concrete5.org/documentation/how-tos/developers/white-labelling/">white labelling support</a>.</p>
<h2>Get some good addons</h2>
<p><a href="http://www.concrete5.org/marketplace/addons/designer-content/">Designer Content</a>.  While it&#8217;s worthwhile to learn to create your own block, this addon keeps a lot of the great UI that&#8217;s built into concrete5 (for example, the image cropping tool and the link creation tool is built in).</p>
<p><a href="http://www.concrete5.org/marketplace/addons/manual-nav/">Manual Nav</a>. The Auto-nav block that comes with concrete5 is great but I find this one is actually a bit easier to use (which I am guessing means clients will find it easier to use too. Which means they will call you less).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete-5-setup-a-checklist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concrete5: Magic Method in the Page List</title>
		<link>http://redconservatory.com/blog/concrete5-magic-method-in-the-page-list/</link>
		<comments>http://redconservatory.com/blog/concrete5-magic-method-in-the-page-list/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 13:34:06 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1529</guid>
		<description><![CDATA[Concrete5 has a magic method in the PageList Class that allows you to &#8220;grab&#8221; a list of pages by a custom page attribute. For example, if you have custom (Boolean) attribute called &#8220;event_section&#8221;: &#160; And that custom attribute is added to any page as &#8220;true&#8221; (by checking the checkbox): &#160; You can, by using this [...]]]></description>
			<content:encoded><![CDATA[<p>Concrete5 has a magic method in the PageList Class that allows you to &#8220;grab&#8221; a list of pages by a custom page attribute.</p>
<p>For example, if you have custom (Boolean) attribute called &#8220;event_section&#8221;:</p>
<p><a href="http://redconservatory.com/blog/wp-content/uploads/2012/04/event_section.png"><img class="alignnone size-full wp-image-1530" title="event_section" src="http://redconservatory.com/blog/wp-content/uploads/2012/04/event_section.png" alt="" /></a></p>
<p>&nbsp;</p>
<p>And that custom attribute is added to any page as &#8220;true&#8221; (by checking the checkbox):</p>
<p><a href="http://redconservatory.com/blog/wp-content/uploads/2012/04/page_properties1.png"><img class="alignnone size-full wp-image-1532" title="page_properties" src="http://redconservatory.com/blog/wp-content/uploads/2012/04/page_properties1.png" alt="" width="552" height="329" /></a></p>
<p>&nbsp;</p>
<p>You can, by using this magic method, grab all pages that have this custom attribute.</p>
<p>In this example, the attribute is called &#8220;event_section&#8221; so the magic method will be named:</p>
<p><code>filterByEventSection</code></p>
<p><strong>Remove the underscore</strong>, and capitalize the words divided by the underscore (i.e. &#8220;EventSection&#8221;).</p>
<p><code>$eventSectionList = new PageList();<br />
$eventSectionList-&gt;filterByEventSection(1);</code></p>
<p>This now gives you a variable ($eventSectionList) that is a list of all pages with the custom attribute &#8220;event_section&#8221; checked.</p>
<p>To &#8220;get&#8221; all the sections, use the &lt;strong&gt;get()&lt;/strong&gt; method:</p>
<p><code>$tmpSections = $eventSectionList-&gt;get();</code></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete5-magic-method-in-the-page-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concrete 5 Installation issues and permissions</title>
		<link>http://redconservatory.com/blog/concrete-5-installation-issues-and-permissions/</link>
		<comments>http://redconservatory.com/blog/concrete-5-installation-issues-and-permissions/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 14:14:05 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1509</guid>
		<description><![CDATA[Javascript Errors Often Javascript errors will give you an installation error message. If you are getting an error along the lines of &#8220;please enable Javascript in your browser&#8221; and you know that you are running Javascript in your browser, turn on Firebug / Developer Tools and check your console. For me I had a local install [...]]]></description>
			<content:encoded><![CDATA[<h3>Javascript Errors</h3>
<p>Often Javascript errors will give you an installation error message.</p>
<p>If you are getting an error along the lines of &#8220;<strong>please enable Javascript in your browser</strong>&#8221; and you <strong>know</strong> that you are running Javascript in your browser, turn on Firebug / Developer Tools and check your console.</p>
<p>For me I had a local install where I put special characters or spaces in my folder name, and once I removed these the Javascript error message went away</p>
<h3>Permissions</h3>
<p>If you are getting a &#8220;permissions&#8221; problem with your following folders</p>
<p><code>config<br />
files<br />
packages</code></p>
<p>Open Terminal.</p>
<p>Change to the folder with concrete5. On a Mac often your site is in your Sites folder, so:</p>
<p><code>cd Sites<br />
cd my-folder-name</code></p>
<p>Then try:</p>
<p><code>chmod -R ug+rw config files packages</code></p>
<p>If you get an error like:</p>
<p><code>chmod: Unable to change file mode on [fill in the blank]: Operation not permitted.</code></p>
<p>Try using <strong>sudo</strong></p>
<p><code>sudo chmod -R ug+rw  config files packages</code></p>
<p>On Windows, I believe you can use <a href="http://technet.microsoft.com/en-us/library/bb490994.aspx">runas</a> instead of sudo.</p>
<pre>runas /user:Administrator cmd</pre>
<p>Then check your installation screen in the browser.</p>
<h3>777 problems (or, how to change your &#8220;group&#8221; to the webserver)</h3>
<p>If you find you have to make certain folders (for example, config and files) 777 to either run your site or to install concrete5, you have to change your &#8220;group&#8221; permissions to your web server.</p>
<p>For example, if you switch into your web folder (the folder with &#8220;blocks&#8221; , &#8220;concrete&#8221; etc)&#8230;for me it&#8217;s public_html and type</p>
<p><code>ls -la</code></p>
<p>You might see something like:</p>
<p><code>drwxr-rw-r--@ 6 my-username staff 204 21 date foldername</code></p>
<h3>Localhost</h3>
<p>On a MAC, <strong>my-username</strong> is your &#8220;user&#8221;, and &#8220;staff&#8221; is your group. However, you probably want to make your group your webserver (&#8220;_www&#8221;) and give read write permissions to your web server for:</p>
<p><code>config<br />
files<br />
packages<br />
updates<br />
blocks (optional, for addons like "Designer Blocks") </code></p>
<p>Writing 777 <strong>will </strong>give write permissions to your web server&#8230;and everybody else (i.e. the world). A better way is to <strong>set your webserver to be your group</strong> by changing into your web folder (the folder that contains &#8220;blocks&#8221;, &#8220;concrete&#8221;, &#8220;config&#8221; and so on)</p>
<p><code>sudo chown -R your-username:_www .</code></p>
<p>Then when you type</p>
<p><code>ls -la</code></p>
<p>You should see</p>
<p><code>drwxr-rw-r--@ 6 my-username _www 204 21 date foldername</code></p>
<p><strong>CHOWN</strong> changes the owner. It&#8217;s in the format <strong>CHOWN user:group</strong>, so:</p>
<p><code>CHOWN my-username:_www</code></p>
<p>- sets the user to me (my username) and the group to &#8220;_www&#8221; (the webserver on my MAC).</p>
<p><strong>-R</strong> changes the permission of the folder, and also anything inside the folder (including other files and folders). <strong>-R</strong> stands for recursive.</p>
<p>Then you can set:</p>
<p><code>sudo chmod -R ug+rwX files packages updates config blocks</code></p>
<p>The capital <strong>&#8220;X&#8221;</strong> gives webserver &#8220;execute&#8221; access on directories (which it needs) but doesn&#8217;t let it execute any of the files in your directories (which you do NOT want&#8230;for example if someone uploads a malicious file to that directory, you want to make sure no one is running or executing the file except for you).</p>
<h3>Shared hosting</h3>
<p>Shared hosting is trickier because the settings are different for each hosting service.</p>
<p>For my hosting service, my apache webserver is referenced by <strong>&#8220;nobody&#8221;</strong>, so if I had problems with setting something to say, 755 or 644 I could try setting my group to <strong>&#8220;nobody&#8221;</strong> so that my webserver has the same permissions as my user (me).</p>
<p><code>sudo chmod -R 755 config/ files/ packages/<br />
sudo chmod 644 config/site.php<br />
sudo chmod 755 sitemap.xml</code></p>
<p>Reference:</p>
<p>http://likesalmon.net/little-changes-to-get-concrete5-working/</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete-5-installation-issues-and-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Why won&#8217;t my loop work? (i.e. using closures)</title>
		<link>http://redconservatory.com/blog/javascript-why-wont-my-loop-work/</link>
		<comments>http://redconservatory.com/blog/javascript-why-wont-my-loop-work/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 19:40:57 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1500</guid>
		<description><![CDATA[Take a simple example: for (var i = 0; i &#60; 3; i++) { console.log("Hello: " + i); } This will output Hello: 0 Hello: 1 Hello: 2 But what if you need to do something more complicated than one line of javascript? var obj = {} for (var i = 0; i &#60; 3; [...]]]></description>
			<content:encoded><![CDATA[<p>Take a simple example:</p>
<p><code>for (var i = 0; i &lt; 3; i++) {<br />
console.log("Hello: " + i);<br />
}</code></p>
<p>This will output</p>
<p><code>Hello: 0<br />
Hello: 1<br />
Hello: 2</code></p>
<p>But what if you need to do something more complicated than one line of javascript?</p>
<pre><code>var obj = {}
for (var i = 0; i &lt; 3; i++) {
	obj[i] = function() {
		console.log('Hello' + i);
	}
}
for (var j = 0; j &lt; 3; j++) {
	obj[j]();
}</code></pre>
<p>This will output:</p>
<p><code>The current number<br />
is 3<br />
The current number<br />
is 3<br />
The current number<br />
is 3<br />
</code></p>
<h3>What&#8217;s happening?</h3>
<p>What is happening is scope in javascript doesn&#8217;t work the way you think it works.</p>
<pre><code>function() {
	a variable in this block {
		still applies inside of this inner block!
	}
}</code></pre>
<pre><code>for (var i = 0; i &lt; 3; i++) {
	console.log("My value: " + i);
	for (var j = 0; j &lt; 3; j++) {
		console.log("My value: " + i);
	}
}</code></pre>
<p>The first four lines will give you</p>
<p><code>My value: 0<br />
My value: 0<br />
My value: 0<br />
My value: 0<br />
</code></p>
<p>Meaning, the value of i is the same inside the brackets of the inner loop as &#8220;i&#8221; is in the outer loop.</p>
<p>When you write:</p>
<pre><code>for (var i = 0; i &lt; 3; i++) {
	obj[i] = function() {
		console.log('Hello' + i);
	}
}</code></pre>
<p><strong>obj[i]</strong> is first assigned 0.</p>
<p>Then <strong>obj[i]</strong> is assigned 1. Then obj[i] is assigned 2&#8230;</p>
<p>3 is the final value. Which gives you:</p>
<p><code>The current number<br />
is 3</code></p>
<p>Instead, make your inner function <strong>return a function</strong>. The inner function will <strong>close over</strong> the value before returning it, in this example, the value of i:</p>
<pre><code>var item = [];
function hello(i) {
	return function() { console.log('Hello' + i); }
}
for (var i = 0; i &lt; 3; i++) {
	item[i] = hello(i);
}
for (var j = 0; j &lt; 3; j++) {
	item[j]();
}</code></pre>
<p>Reference: http://stackoverflow.com/questions/111102/how-do-javascript-closures-work</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/javascript-why-wont-my-loop-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: removing menus in the Admin</title>
		<link>http://redconservatory.com/blog/wordpress-removing-menus-in-the-admin/</link>
		<comments>http://redconservatory.com/blog/wordpress-removing-menus-in-the-admin/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 19:05:56 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1494</guid>
		<description><![CDATA[Here is a way to remove menu items in the Admin side for users who aren&#8217;t administrators:]]></description>
			<content:encoded><![CDATA[<p>Here is a way to remove menu items in the Admin side for users who aren&#8217;t administrators:</p>
<p><script src="https://gist.github.com/2439142.js?file=menu-admin.php"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/wordpress-removing-menus-in-the-admin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Compass</title>
		<link>http://redconservatory.com/blog/using-compass/</link>
		<comments>http://redconservatory.com/blog/using-compass/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 18:14:47 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1492</guid>
		<description><![CDATA[LESS is a great CSS preprocessor and I will probably keep using it with bootstrap (which, as you can tell, is what I am using for my current WordPress theme). However, I have started using Compass and I realized it&#8217;s not as scary as it seems. The Command Line Yes, Compass is a gem but not to worry &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lesscss.org/">LESS</a> is a great CSS preprocessor and I will probably keep using it with <a href="http://twitter.github.com/bootstrap/">bootstrap</a> (which, as you can tell, is what I am using for my current WordPress theme).</p>
<p>However, I have started using <a href="http://compass-style.org/">Compass</a> and I realized it&#8217;s not as scary as it seems.</p>
<h3>The Command Line</h3>
<p>Yes, Compass is a <a href="http://docs.rubygems.org/read/chapter/1#page22">gem</a> but not to worry &#8211; it&#8217;s not like trying to <a href="http://guides.rubyonrails.org/getting_started.html">install rails</a>.</p>
<p>All you need to do is open terminal and type:</p>
<p><code>$ gem update --system<br />
$ gem install compass</code></p>
<p>That&#8217;s it!</p>
<h3>Make a site</h3>
<p>Let&#8217;s say you want to make a site in your &#8220;Sites&#8221; folder called &#8220;example&#8221;.</p>
<p>Open Terminal.</p>
<p>Type the following</p>
<p><code>cd Sites<br />
$ compass create example</code></p>
<h3>Folder structure</h3>
<p>Compass will create a few folders.</p>
<h4>Sass</h4>
<p>Compass .scss files go here</p>
<h4>stylesheets</h4>
<p>Regular .css style sheets go here. Compass will generate .css stylesheets based on the files in &#8220;Sass&#8221;.</p>
<h4>.sass-cache</h4>
<p>I have yet to go in and change anything in the .sass-cache folder.</p>
<h3>Config.rb</h3>
<p>If you don&#8217;t want to store your compass files in <strong>sass</strong> or your css files in <strong>stylesheets </strong>you can change your configuration here.</p>
<h3>Using 960 with Compass</h3>
<p>The 960 grid used to come prepackaged with Compass, but now <a href="https://github.com/timriley/compass-960-plugin">Tim Riley keeps it on his github</a>.</p>
<p>You can install it by opening Terminal and typing:</p>
<pre>gem install compass-960-plugin</pre>
<p>For the example above, if you want to create a site called <strong>example</strong> in your <strong>Sites folder:</strong></p>
<p><code>cd Sites<br />
compass create -r ninesixty example --using 960</code></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/using-compass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concrete5, placing editable blocks in a template</title>
		<link>http://redconservatory.com/blog/concrete5-restricting-an-area-to-a-particular-block/</link>
		<comments>http://redconservatory.com/blog/concrete5-restricting-an-area-to-a-particular-block/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 16:37:36 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1486</guid>
		<description><![CDATA[In Concrete5 you can create an editable area by adding this: &#60;?php $a = new Area('My Area Name'); $a-&#62;display($c); ?&#62; The only problem is that areas in concrete5 can contain many blocks &#8211; as many blocks as the user likes. If you only want the user to edit a particular block (and not add as many [...]]]></description>
			<content:encoded><![CDATA[<p>In Concrete5 you can create an editable <strong>area</strong> by adding this:</p>
<p><code>&lt;?php<br />
$a = new Area('My Area Name');<br />
$a-&gt;display($c);<br />
?&gt;</code></p>
<p>The only problem is that <strong>areas </strong>in concrete5 can contain many blocks &#8211; as many blocks as the user likes.</p>
<p>If you only want the user to edit a particular block (and not add as many blocks as they would like, another method is to replace the <strong>area</strong> with a block.</p>
<h3>Replace the area with an autonav block</h3>
<p><code>&lt;?php<br />
$autonav = BlockType::getByHandle('autonav');<br />
$autonav-&gt;controller-&gt;orderBy = 'display_asc';<br />
$autonav-&gt;controller-&gt;displayPages = 'top';<br />
$autonav-&gt;render('templates/my-custom-template');<br />
?&gt;</code></p>
<h3>Replace the area with a content block</h3>
<p><code>&lt;?php<br />
$content = BlockType::getByHandle('content');<br />
$content-&gt;render('templates/my-custom-template');<br />
?&gt;</code></p>
<h3>Replace the area with a Google Map block</h3>
<p><code>&lt;?php<br />
$googlemap = BlockType::getByHandle('google_map');<br />
$googlemap-&gt;render('view');<br />
?&gt;</code></p>
<h3>Replace the area with an image</h3>
<p><code>&lt;?php<br />
$image = BlockType::getByHandle('image');<br />
$image-&gt;render('view');<br />
?&gt;</code></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/concrete5-restricting-an-area-to-a-particular-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress and Concrete5: themes, templates</title>
		<link>http://redconservatory.com/blog/wordpress-and-concrete5-themes-templates/</link>
		<comments>http://redconservatory.com/blog/wordpress-and-concrete5-themes-templates/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 16:00:50 +0000</pubDate>
		<dc:creator>nicole</dc:creator>
				<category><![CDATA[concrete5]]></category>

		<guid isPermaLink="false">http://redconservatory.com/blog/?p=1465</guid>
		<description><![CDATA[Themes WordPress and Concrete5 both have theme folders. In WordPress, the folder structure looks like: -public_html (or what your web folder is called) --wp-content ----themes --------my-special-theme In Concrete5, there are two theme folders -public_html (or what your web folder is called) --themes --concrete ----themes The outer theme folder is where you put your custom themes. The [...]]]></description>
			<content:encoded><![CDATA[<h3>Themes</h3>
<p>WordPress and Concrete5 both have <strong>theme</strong> folders.</p>
<p>In WordPress, the folder structure looks like:</p>
<p><code>-public_html (or what your web folder is called)<br />
--wp-content<br />
----themes<br />
--------my-special-theme</code></p>
<p>In Concrete5, there are two theme folders</p>
<p><code>-public_html (or what your web folder is called)<br />
--themes<br />
--concrete<br />
----themes</code></p>
<p>The <strong>outer theme folder</strong> is where you put your <strong>custom themes</strong>.</p>
<p>The theme folder <strong>inside</strong> the folder marked <strong>concrete5 </strong>are where the<strong> default themes</strong> are placed.</p>
<p>As a general rule, <strong>do not put any of your own code</strong> inside of the <strong>concrete5 folder</strong>.</p>
<h3>Templates</h3>
<p>In WordPress, templates go inside of your <strong>theme</strong> folder.</p>
<p>Each template file begins with:</p>
<p><code>&lt;?php<br />
/**<br />
* Template Name: Name of my template<br />
*/<br />
</code></p>
<p>In Concrete5, template pages (and other pages) often begin with:</p>
<p><code>&lt;?php defined('C5_EXECUTE') or die("Access Denied.");</code></p>
<p>In WordPress, content is placed into the template with <a href="http://codex.wordpress.org/Template_Tags">template tags</a>:</p>
<p><code>&lt;h1&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/h1&gt;</code></p>
<p>In Concrete5, instead of using tags for the title, content, pagination, and so on, instead you mark out areas of editable content:</p>
<p><code>&lt;?php<br />
$a = new Area('Main');<br />
$a-&gt;display($c);<br />
?&gt;</code></p>
<p>In the example above, the area is called &#8216;Main&#8217; but it can be other things too:</p>
<p><code>&lt;?php<br />
$a = new Area('Sidebar');<br />
$a-&gt;display($c);<br />
?&gt;</code></p>
<h3>Headers and Footers</h3>
<p>WordPress and Concrete5 both need special header and footer code.</p>
<p>In WordPress, this places the header on a template page:</p>
<p><code>&lt;?php get_header(); ?&gt;</code></p>
<p>Also, you have to make sure to include this file in your <strong>header.php </strong>page <strong>before</strong> your &lt;/head&gt; tag:</p>
<p><code>&lt;?php wp_head(); ?&gt;</code></p>
<p>Include the footer template by writing:</p>
<p><code>&lt;?php get_footer( $name ); ?&gt;</code></p>
<p>And you &#8220;hook&#8221; into the footer by including this in footer.php:</p>
<p><code>&lt;?php wp_footer(); ?&gt;</code></p>
<p>Without <strong>wp_head</strong> or <strong>wp_footer</strong>, you will break many of your WordPress plugins which rely on these hooks to add items to your header (for example, any plugin that needs to include custom css or javascript in the head of your HTML document.</p>
<p>In Concrete5, you include the header by replacing your &lt;title&gt;&lt;/title&gt; tags with</p>
<p><code><span style="font-family: monospace;">&lt;?php  Loader::element('header_required'); ?&gt;</span></code></p>
<p>And in the footer:</p>
<p><code>&lt;?php Loader::element('footer_required'); ?&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://redconservatory.com/blog/wordpress-and-concrete5-themes-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

