<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.juliakm.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Drupal</title>
 <link>http://www.juliakm.com/topics/drupal</link>
 <description>The taxonomy view with a depth of 0.</description>
 <language>en</language>
<item>
 <title>Paging NikLP: Deciding between CCK Fields and Taxonomy</title>
 <link>http://www.juliakm.com/paging-niklp-deciding-between-cck-fields-and-taxonomy</link>
 <description>&lt;p&gt;I&#039;m trying to decide between using a CCK field or taxonomy to classify content on a new site. We plan to have various node types (video, podcasts, forum topics, news articles, courses, etc.) and want to be able to dynamically pull together all nodes with the same tag in a page. There will be dynamic pages for both universities and topics. The topics will have a hierarchy. For example:&lt;/p&gt;
&lt;p&gt;Campus Operations (located at &lt;a href=&quot;http://www.mysite.com/topic/campus-operations&quot; title=&quot;www.mysite.com/topic/campus-operations&quot;&gt;www.mysite.com/topic/campus-operations&lt;/a&gt;)&lt;br /&gt;
&amp;#8212; Climate  (located at &lt;a href=&quot;http://www.mysite.com/topic/campus-operations/climate&quot; title=&quot;www.mysite.com/topic/campus-operations/climate&quot;&gt;www.mysite.com/topic/campus-operations/climate&lt;/a&gt;)&lt;br /&gt;
&amp;#8212;&amp;#8212;Greenhouse Gas Inventories  (located at &lt;a href=&quot;http://www.mysite.com/topic/campus-operations/climate/greenhouse-gas-inventories&quot; title=&quot;www.mysite.com/topic/campus-operations/climate/greenhouse-gas-inventories&quot;&gt;www.mysite.com/topic/campus-operations/climate/greenhouse-gas-inventorie...&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;As detailed above, Campus Operations, Climate, and Greenhouse Gas Inventories should each have their own page. I would also be able to see that Greenhouse Gas Inventories has the parent page Climate and that its parent is Campus Operations. &lt;a href=&quot;/resources/rc_topicpage.pdf&quot;&gt;Here&amp;#8217;s a very rough example topic page&lt;/a&gt; and a &lt;a href=&quot;/resources/rc_schoolpage.pdf&quot;&gt;university one&lt;/a&gt;. I would also like to be able to associate one page with multiple parents. For example, Greenhouse Gas Inventories may also have a parent page of Campus Inventories. Additionally, it should be easy to generate a dynamic listing of topics in their hierarchy with links to the topic pages. &lt;/p&gt;
&lt;p&gt;If associating topic pages with more than one parent page is too difficult, then changing parent topics should at least be easy to change. For example, I might want to change the tag Greenhouse Gas Inventories to GHG Inventories and then have all of the content with the old tag now be tagged with the new term. Using CCK fields, I&amp;#8217;ve had problems with this in the past. &lt;/p&gt;
&lt;p&gt;If I use a taxonomy, I&#039;ll probably wind up with at least 4 levels.&lt;/p&gt;
&lt;p&gt;Topic A&lt;br /&gt;
&amp;#8212;Topic AB&lt;br /&gt;
&amp;#8212;&amp;#8212;-Topic ABC&lt;br /&gt;
&amp;#8212;&amp;#8212;&amp;#8212;-Topic ABCD&lt;/p&gt;
&lt;p&gt;It needs to be easy for administrators to add new topics sub-topics. We may also want to let users tag content. However, I can imagine that a potential user may take one look at our complex taxonomy and run for the hills. I understand that one option for presenting taxonomy to users may be to use something like &lt;a href=&quot;http://drupal.org/project/content_taxonomy&quot;&gt;Content Taxonomy&lt;/a&gt; and make the interface simpler. &lt;/p&gt;
&lt;p&gt;To add even more complexity, I need to be able to make some taxonomy terms only visible to specific roles. &lt;/p&gt;
&lt;p&gt;In summary, here are my requirements for topics:&lt;br /&gt;
- Classify many node types in a hierarchical list with a minimum of four levels&lt;br /&gt;
- Dynamically generate pages for some but not all terms (most likely using Views). The pages should have a specific layout.&lt;br /&gt;
- It should be easy for users to tag new content&lt;br /&gt;
- Administrators need to be able to edit the terms without causing problems later on&lt;br /&gt;
- Some dynamically-generated pages should only be visible to users with specific roles&lt;/p&gt;
&lt;h3 id=&quot;and_there8217s_more8230&quot;&gt;And there&amp;#8217;s more&amp;#8230;&lt;/h3&gt;
&lt;p&gt;In addition to a topic taxonomy, I will need to build a taxonomy (or CCK field) for universities. Ideally, I would be able to easily pull all universities in California with greenhouse gas inventories. I&amp;#8217;m thinking that the best approach for this will be to have a either a cck nodereference field for universities where each university has a node or a taxonomy of U.S. universities broken out by location. If I went with a nodereference field, then the university nodes would have to have a location cck field. &lt;/p&gt;
&lt;p&gt;The goal would be to easily generate links like this:&lt;br /&gt;
&lt;a href=&quot;http://www.mysite.com/schools/california/campus-operations/climate/greenhouse-gas-inventory&quot; title=&quot;www.mysite.com/schools/california/campus-operations/climate/greenhouse-gas-inventory&quot;&gt;www.mysite.com/schools/california/campus-operations/climate/greenhouse-g...&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I think that this can be achieved by views, but I don&amp;#8217;t want to overlook any ways of structuring the data that will make for easier querying later on. &lt;/p&gt;
&lt;p&gt;Here are a few articles that have added to my confusion:&lt;br /&gt;
&lt;a href=&quot;http://www.darcynorman.net/2008/04/24/complex-hierarchical-taxonomies-in-drupal/&quot; title=&quot;http://www.darcynorman.net/2008/04/24/complex-hierarchical-taxonomies-in-drupal/&quot;&gt;http://www.darcynorman.net/2008/04/24/complex-hierarchical-taxonomies-in...&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.johnandcailin.com/blog/cailin/drupal-cck-vs-taxonomy&quot; title=&quot;http://www.johnandcailin.com/blog/cailin/drupal-cck-vs-taxonomy&quot;&gt;http://www.johnandcailin.com/blog/cailin/drupal-cck-vs-taxonomy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It seems like I have a few options:&lt;/p&gt;
&lt;p&gt;1) Create Multiple CCK fields or CCK fields for each level of my topic hierarchy and also have a cck nodereference field for universities. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;br /&gt;
- CCK fields can be hidden or shown for different node types, which is easier for end users to understand.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages:&lt;/strong&gt;&lt;br /&gt;
- Even if I use hierarchical select CCK fields, CCK doesn&amp;#8217;t have the built in advantages of taxonomy. Displaying breadcrumbs won&amp;#8217;t be as easy, there is not a set of API functions ready to be called. &lt;/p&gt;
&lt;p&gt;2) Have a taxonomy for topics and also use a taxonomy for universities broken down by location. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;br /&gt;
- Taxonomies can easily handle the 4-level hierarchy&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages:&lt;/strong&gt;&lt;br /&gt;
- Commits to using taxonomy/term link structure (not sure about this)&lt;br /&gt;
- Taxonomies may seem overly complex to end users&lt;br /&gt;
- Long-term it might not make sense to classify universities by location. Some schools have multiple location. &lt;/p&gt;
&lt;p&gt;3) Have a taxonomy for topics and use a cck nodereference field for universities.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;br /&gt;
- Taxonomies can easily handle the 4-level hierarchy&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages:&lt;/strong&gt;&lt;br /&gt;
- Requires creating a node for each university. Some of these nodes will have very little data.&lt;br /&gt;
- Taxonomies may seem overly complex to end users&lt;/p&gt;
&lt;p&gt;4) Have a taxonomy for topics, a cck field for universities, and a field for school location&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;br /&gt;
- Lets me pull information by location that doesn&amp;#8217;t necessarily relate to a school&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Disadvantages&lt;/strong&gt;&lt;br /&gt;
- It could be cumbersome to associate universities and locations later on&lt;br /&gt;
- Taxonomies may seem overly complex to end users&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;I think that it makes the most sense to use a taxonomy for the topics and a nodereference field for universities. In the university node, there will be a field for location. This will require creating approximately 4,000 university nodes, which may lead to performance problems later on. &lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/paging-niklp-deciding-between-cck-fields-and-taxonomy#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/story/drupal">drupal</category>
 <pubDate>Thu, 16 Oct 2008 16:38:42 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">46 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Adding author name to the Drupal search index</title>
 <link>http://www.juliakm.com/adding-author-name-drupal-search-index</link>
 <description>&lt;p&gt;Awhile back, I wanted to add author names to the Drupal search index. After poking around a bit, I found that this was actually pretty easy. I created a new module called custom_helper and in it put the following function:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;//Adding author name to the search index&lt;br /&gt;function custom_helper_nodeapi($node, $op, $arg = 0) {&lt;br /&gt;&amp;nbsp; switch ($op) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &amp;#039;update index&amp;#039;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($node-&amp;gt;uid) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $user = user_load(array(&amp;#039;uid&amp;#039; =&amp;gt; $node-&amp;gt;uid));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $user-&amp;gt;name;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; }&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;One thing to keep in mind is that if you do this, then you will need to re-index all of your previously indexed nodes if you wanted them to be indexed by author name. &lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/adding-author-name-drupal-search-index#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <pubDate>Tue, 01 Apr 2008 08:04:11 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">44 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Adding to $items in a Drupal view</title>
 <link>http://www.juliakm.com/adding-items-drupal-view</link>
 <description>&lt;p&gt;I recently needed to add an extra link to the end of my $items list in a list view and found that this could be done quickly in template.php. &lt;/p&gt;
&lt;p&gt;I set out to do two things:&lt;br /&gt;
- add a link to the end of my list view that does not contain node data&lt;br /&gt;
- as part of this last list item, include a custom link that changes depending on the name of the view&lt;/p&gt;
&lt;p&gt;Accomplishing this was a lot easier than I expected. All I had to do was add a switch statement for the view name, and also add a line with the content I wanted to add to my $items array before the theming function.&lt;br /&gt;
&lt;!--break--&gt;&lt;br /&gt;
Here is my code:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;font color=&quot;#0000CC&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;function &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;phptemplate_views_view_list_myview&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$view&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$nodes&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$type&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$fields &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;_views_get_fields&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;();&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$taken &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= array();&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#FF9900&quot;&gt;// Set up the fields in nicely named chunks.&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;foreach (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$view&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;field &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;as &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$id &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;=&amp;gt; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_name &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;field&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isset(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$taken&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_name&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_name &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;queryname&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$taken&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_name&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;true&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_names&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$id&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_name&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#FF9900&quot;&gt;// Set up some variables that won&#039;t change.&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$base_vars &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view&#039; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;=&amp;gt; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$view&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view_type&#039; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;=&amp;gt; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$type&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;,&lt;br /&gt;&amp;nbsp; );&lt;br /&gt;&lt;br /&gt;&amp;nbsp; foreach (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$nodes &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;as &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$i &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;=&amp;gt; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$base_vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;node&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;fullNode&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;node_load&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;nid&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;link&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;l&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;fullNode&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;]-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;body&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;node/&#039; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;. &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;nid&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;count&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$i&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;stripe&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$i &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;% &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;2 &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;? &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;even&#039; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;: &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;odd&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#FF9900&quot;&gt;//adding extra variable for view name contextual links, in a template, this will be $linked_page. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;switch (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;]-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;name&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view_one&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;linked_page&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;/news/special_one&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view_two&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;linked_page&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;/news/special_two&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view_three&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;linked_page&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;/news/special_three&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view_four&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;linked_page&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;/news/special_four&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$view&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;field &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;as &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$id &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;=&amp;gt; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$name &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field_names&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$id&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$name&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;views_theme_field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;views_handle_field&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;queryname&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;], &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$fields&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$view&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isset(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;label&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$name &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;. &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;_label&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$field&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;label&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$items&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[] = &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;_phptemplate_callback&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;views-happy_news&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#FF9900&quot;&gt;//the key, I&#039;m adding a link to the $items[] array. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$items&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[] =&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&quot;&amp;lt;a href=\&quot;{$vars[&#039;linked_page&#039;]}\&quot; class=\&quot;more-articles\&quot;&amp;gt;See more news&amp;lt;/a&amp;gt; »&quot;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;&amp;nbsp; if (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$items&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;theme&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;item_list&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$items&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/adding-items-drupal-view#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <pubDate>Mon, 17 Mar 2008 08:57:01 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">43 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Gettting Rid of &quot;cgi-system&quot; When Upgrading Drupal on Dreamhost </title>
 <link>http://www.juliakm.com/gettting-rid-cgi-system-when-upgrading-drupal-dreamhost</link>
 <description>&lt;p&gt;I recently upgraded this site from Drupal 5.1 to 5.7 on Dreamhost and ran into an odd problem. After upgrading, all of my urls included the path cgi-system. So, instead of my login page being at juliakm.com/user, it was at juliakm.com/cgi-system/user. Because of the url issue, my site lost its theme. &lt;/p&gt;
&lt;p&gt;To solve the problem, I had to add a $base_url setting in my settings.php file in sites/default to &lt;a href=&quot;http://www.juliakm.com&quot; title=&quot;http://www.juliakm.com&quot;&gt;http://www.juliakm.com&lt;/a&gt;. However, because I had used Dreamhost&#039;s 1-click install, it was impossible to edit this file via FTP. Instead, I had to log into my site via SSH, and then chmod the permissions on settings.php to make the file editable. &lt;/p&gt;
&lt;p&gt;First, I navigated to the right folder:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;cd mysite.com/sites/default&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Next, I changed the settings.php permissions:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;chmod 755 settings.php&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Finally, with pico, I was able to uncomment the $base_url line and edit it:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$base_url = &amp;#039;http://www.juliakm.com&amp;#039;;&amp;nbsp; // NO trailing slash!&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;It looks like I am not the only one who has ran into this problem on Dreamhost. Here are other tales of Drupal + Dreamhost upgrade misery:&lt;br /&gt;
&lt;a href=&quot;http://drupal.org/node/60139&quot; title=&quot;http://drupal.org/node/60139&quot;&gt;http://drupal.org/node/60139&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://drupal.org/node/163085&quot; title=&quot;http://drupal.org/node/163085&quot;&gt;http://drupal.org/node/163085&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://drupal.org/node/163870&quot; title=&quot;http://drupal.org/node/163870&quot;&gt;http://drupal.org/node/163870&lt;/a&gt;&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/gettting-rid-cgi-system-when-upgrading-drupal-dreamhost#comments</comments>
 <category domain="http://www.juliakm.com/story/dreamhost">Dreamhost</category>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <pubDate>Sun, 16 Mar 2008 07:18:45 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">41 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Displaying Nodeprofile Fields for a User within a Node</title>
 <link>http://www.juliakm.com/displaying-nodeprofile-fields-user-within-node</link>
 <description></description>
 <comments>http://www.juliakm.com/displaying-nodeprofile-fields-user-within-node#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/story/nodeprofile">nodeprofile</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <pubDate>Sun, 03 Feb 2008 08:49:33 -0800</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">40 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Drupal Permissions Issues: A Debugging Checklist</title>
 <link>http://www.juliakm.com/drupal-permissions-issues-debugging-checklist</link>
 <description>&lt;p&gt;Every once in awhile, when working on a Drupal site, my content either disappears or I cannot log-in. At this point, I usually get rather angry and start thinking of worse case scenarios. What if I can never log into my site again? What if anonymous users can&#039;t read articles?&lt;/p&gt;
&lt;p&gt;In a rare moment of clarity, I put together the following Drupal permissions debugging checklist. I hope that you find it as useful as I have.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Check user access control and make sure that all users can &quot;access content&quot;&lt;/strong&gt;&lt;br /&gt;
&lt;em&gt;Path:&lt;/em&gt; mysite.com/admin/user/access&lt;br /&gt;
Often, when installing a module, I accidentally change key permissions. For example, a couple of times I have allowed anonymous users to &quot;access content&quot; but not logged-in ones. Although my access control permissions are usually not the problem, its always best to check them before moving onto the next approaches. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Check input filter roles&lt;/strong&gt;&lt;br /&gt;
&lt;em&gt;Path:&lt;/em&gt; mysite.com/admin/settings/filters&lt;br /&gt;
One problem with having a lot of input filters is that you can easily mess up the permissions of a particular filter. If a user does not have permission to use an input filter, then they cannot edit content that can only be edited with that input filter. To give a real-world example, say that I set up a new input filter called &quot;tinyMCE.&quot; Next, I set up my permissions for tinyMCE so that only my webmaster role can use the tinyMCE input filter. While doing this, I also set permissions so that only the webmaster can use my &quot;Filtered HTML&quot; and &quot;Full HTML&quot; input filters. Next, I set up a new role called &quot;intern&quot; and let the intern edit content. However, my intern reports that he cannot access any of the edit pages. Why? He needs to have access to the &quot;tinyMCE&quot; input filter. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Clear site cache and views cache&lt;/strong&gt;&lt;br /&gt;
&lt;em&gt;Path for Views Cache:&lt;/em&gt; mysite.com/admin/build/views/tools&lt;br /&gt;
Sometimes site cache and views cache can result in strange permissions problem. Site cache can be reset with the Developer module &quot;Empty cache&quot; menu option. To have this appear, you need to enable the Devel block. In addition to clearing the site cache, sometimes it helps to clear the ciews cache. This is especially true if your permissions problems started after you edited a view. The option to clear views cache can be found in the Tools section of the ciews administration page.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4. If all else fails, rebuild node permissions&lt;/strong&gt;&lt;br /&gt;
&lt;em&gt;Path:&lt;/em&gt; mysite.com/admin/content/node-settings/rebuild&lt;br /&gt;
Sometimes Drupal node permissions get corrupted. When this happens, rebuilding the node permissions can solve the problem. Please be advised that if you have a lot of nodes, this can take a very long time. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5. The Last Step: Looking for Module-Specific Issues&lt;/strong&gt;&lt;br /&gt;
&lt;em&gt;Path for Update Script:&lt;/em&gt; mysite.com/update.php&lt;br /&gt;
If none of the previous steps work, I usually try to figure out if the problem is caused by a module that I just installed. First, if I recently installed a new version of a module, I make sure that I have run the update.php script. Next, I generally disable the module, and then repeat step three. &lt;/p&gt;
&lt;p&gt;Please let me know if there are other ways of hunting down and fixing permissions issues that you know about.&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/drupal-permissions-issues-debugging-checklist#comments</comments>
 <category domain="http://www.juliakm.com/story/debugging">debugging</category>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/story/permissions">permissions</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <pubDate>Sat, 12 Jan 2008 12:15:24 -0800</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">39 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Drupal Theming: Create a Subpage Template that Applies to Multiple Pages on a Newspaper Site</title>
 <link>http://www.juliakm.com/drupal-theming-create-subpage-template-applies-multiple-pages-newspaper-site</link>
 <description>&lt;p&gt;While working on a new Drupal site, I needed to set the same &quot;subsection&quot; template for multiple pages. The site is for an online newspaper and I wanted to use a new template for each of the section homepages. A good example of a similar approach is on CNN.com, where the &lt;a href=&quot;http://www.cnn.com/US/&quot;&gt;US section page&lt;/a&gt; looks different than both the &lt;a href=&quot;http://www.cnn.com/&quot;&gt;homepage&lt;/a&gt; and the &lt;a href=&quot;http://www.cnn.com/2008/US/weather/01/06/california.storm.ap/index.html&quot;&gt;article pages&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In past projects, I&#039;ve confused myself with template names. Six months later, I have trouble remembering what page-node-1432.tpl.php actually controls. So, this time, I set out to have better named template files and to have the same template file control multiple pages. So far, this has made it easier for both the project graphic designer and I.&lt;br /&gt;
Here&#039;s the code that I put in my template.php file to make page-subsection.tpl.php the template file for node/17658, node/17638, and node/17628. &lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;font color=&quot;#0000CC&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;function &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;_phptemplate_variables&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$hook&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;, &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= array()) {&lt;br /&gt; switch (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$hook&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;page&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if((&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;arg&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;0&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;)==&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;’node’&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) &amp;amp;&amp;amp; ((&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;arg&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;1&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) == &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;‘17658’&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) || (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;arg&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;1&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) == &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;‘17638’&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) || (&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;arg&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;1&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;) == &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;‘17628’&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;))){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars‘template_files’ &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;= &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;‘page&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;subsection’&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$vars&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This code is effectively saying, if the page you are on has the node id 17658, 17638, or 17628, use the page template page-subsection.tpl.php.&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/drupal-theming-create-subpage-template-applies-multiple-pages-newspaper-site#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <category domain="http://www.juliakm.com/story/theming">theming</category>
 <pubDate>Sun, 06 Jan 2008 09:13:31 -0800</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">38 at http://www.juliakm.com</guid>
</item>
<item>
 <title>PickyRacer.com Up and Running</title>
 <link>http://www.juliakm.com/pickyracer-com-and-running</link>
 <description>&lt;p&gt;I finally launched &lt;a href=&quot;http://www.pickyracer.com/&quot;&gt;PickyRacer.com&lt;/a&gt;. PickyRacer is designed to help connect runners with great marathons, half-marathons, and other races. It is built with Drupal 5.3. In the next few months, I hope to add runner blogs, and groups. There are a bunch of other features that I would like to add as well, but I figure I should start small. &lt;/p&gt;
&lt;p&gt;Here are some of the more useful modules I used when developing the site:&lt;br /&gt;
CCK&lt;br /&gt;
Views&lt;br /&gt;
Views Bookmarks&lt;br /&gt;
Google Analytics&lt;br /&gt;
XML Sitemap&lt;br /&gt;
Node Teaser&lt;br /&gt;
Link&lt;br /&gt;
Fivestar&lt;br /&gt;
Forward&lt;br /&gt;
Location&lt;br /&gt;
Node Comment&lt;br /&gt;
Path Auto&lt;br /&gt;
Voting API&lt;/p&gt;
&lt;p&gt;I plan to implement Organic Groups over the next couple of months after I fix all of the existing bugs.&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/pickyracer-com-and-running#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/story/half-marathons">half-marathons</category>
 <category domain="http://www.juliakm.com/story/marathons">marathons</category>
 <category domain="http://www.juliakm.com/story/pickyracer-com">pickyracer.com</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <category domain="http://www.juliakm.com/story/running">running</category>
 <category domain="http://www.juliakm.com/topics/running">running</category>
 <pubDate>Mon, 31 Dec 2007 15:12:11 -0800</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">37 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Using Imagecache and CCK Imagefield to Add an Image in Drupal</title>
 <link>http://www.juliakm.com/using-imagecache-and-cck-imagefield-add-image-drupal</link>
 <description>&lt;p&gt;Figuring out how to get Drupal&#039;s &lt;a href=&quot;http://drupal.org/project/imagecache&quot;&gt;imagecache module&lt;/a&gt; to work with &lt;a href=&quot;http://drupal.org/project/imagefield&quot;&gt;CCK&#039;s imagefield&lt;/a&gt; can about as fun as a trip to the dentist. Although I found a lot of articles analyzing the benefits of using Image vs. CCK imagefield, I could not find one source with clear instructions on how to implement imagefield with imagecache. So, here&#039;s my stab at an explanation of how to get imagecache to work with imagefield.&lt;/p&gt;
&lt;p&gt;1. Install and activate CCK, imagefield, and imagecache. Go to Admin &gt; Content types and select the content type that you want to add an image field to. Click on &quot;Add field&quot; to add an image field. Then, give your field a title, select Image and create your field. The name of my field is &quot;related_images.&quot;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/resources/u1/createfield.png&quot; alt=&quot;create cck image field&quot; height=&quot;205&quot; width=&quot;278&quot; /&gt;&lt;/p&gt;
&lt;p&gt;2. Set your imagecache presets at Site Building &gt; Image cache. My preset is has the namespace &quot;homepage&quot; and is set to resize with a width and height of 100. &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/resources/u1/namespace.png&quot; alt=&quot;drupal preset namespace&quot; height=&quot;321&quot; width=&quot;500&quot; /&gt;&lt;/p&gt;
&lt;p&gt;3. Go back to the content type that you added a CCK image to by selecting Content Management &gt; Content types. Click on the name of the content type you previously added an image to. In the content type&#039;s menu, select &quot;Display fields.&quot;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/resources/u1/displayfields.png&quot; alt=&quot;display cck image fields&quot; height=&quot;94&quot; width=&quot;415&quot; /&gt;&lt;/p&gt;
&lt;p&gt;4. Look to the right of the listing for the image field you created. Set the teaser and body to the namespace you set in step 2. My namespace is &quot;homepage.&quot; &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/resources/u1/chooselook.png&quot; alt=&quot;set display of cck image&quot; height=&quot;66&quot; width=&quot;500&quot; /&gt;&lt;/p&gt;
&lt;p&gt;5. Add a new article of content using the content type that has your new image field. Upload an image as part of the post and make sure that your image displays at the width and height you set in &quot;Display fields.&quot;&lt;/p&gt;
&lt;p&gt;
6. If you want to have your image display in a template such as node.tpl.php, the following code will print the image and image title for a CCK image field called field_related_images:
&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;font color=&quot;#0000CC&quot;&gt;&amp;lt;?php &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;print &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;field_related_images&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;0&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;][&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;view&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;]; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt; &lt;br /&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;font color=&quot;#0000CC&quot;&gt;&amp;lt;?php &lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;print &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;$node&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;-&amp;gt;&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;field_related_images&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;0&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;][&lt;/font&gt;&lt;font color=&quot;#CC0000&quot;&gt;&#039;title&#039;&lt;/font&gt;&lt;font color=&quot;#006600&quot;&gt;];&amp;nbsp; &lt;/font&gt;&lt;font color=&quot;#0000CC&quot;&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
</description>
 <comments>http://www.juliakm.com/using-imagecache-and-cck-imagefield-add-image-drupal#comments</comments>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/topics/programming">programming</category>
 <pubDate>Mon, 20 Aug 2007 17:11:17 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">31 at http://www.juliakm.com</guid>
</item>
<item>
 <title>Getting Drupal&#039;s Search Module to Work on Dreamhost</title>
 <link>http://www.juliakm.com/getting-drupals-search-module-work-dreamhost</link>
 <description></description>
 <comments>http://www.juliakm.com/getting-drupals-search-module-work-dreamhost#comments</comments>
 <category domain="http://www.juliakm.com/story/cron">cron</category>
 <category domain="http://www.juliakm.com/topics/drupal">Drupal</category>
 <category domain="http://www.juliakm.com/story/search-module">search module</category>
 <pubDate>Sat, 30 Jun 2007 16:16:50 -0700</pubDate>
 <dc:creator>Julia</dc:creator>
 <guid isPermaLink="false">21 at http://www.juliakm.com</guid>
</item>
</channel>
</rss>
