<?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"
	>
<channel>
	<title>Comments on: How to handle urls for &#8220;mini sites&#8221; in panels 2</title>
	<atom:link href="http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/</link>
	<description>Men have become the tools of their tools.   - Henry David Thoreau</description>
	<pubDate>Tue, 06 Jan 2009 19:40:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: ekes</title>
		<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/#comment-170</link>
		<dc:creator>ekes</dc:creator>
		<pubDate>Wed, 16 Jul 2008 07:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://pajamadesign.com/?p=32#comment-170</guid>
		<description>I've just done similar on http://demo.nabuurtest.com/ http://feedback.nabuur.com/ (both devel sites one should be working to some degree at any moment) and did it with custom_url_rewrite. 

To solve the i18n problem I just called the i18n_path_alias from within my custom_url_rewrite. The i18n module is quite civilised here and doesn't create a custom_url_rewrite if there is one existing already, so no patching required there either.

So cutting useful bits from code you have something like:

&lt;code&gt;
if ($op == 'alias') {
  $result = i18n_url_rewrite($op, $result, $path);
...
    elseif (preg_match("@node/([0-9]+)/($subpages_or)(?:/feed)?$@", $path, $path_pieces)) {
      // [group&#124;village]/[background&#124;images&#124;...]
      $group_node = 'node' .'/'. $path_pieces[1];
      $group_path = drupal_lookup_path('alias', $group_node);
      if ($group_path != '') {
        $result = $group_path .'/'. $path_pieces[2];
      }
    }
...
if ($op == 'source') {
      if (preg_match("@($types_or)/([^/\?\s]+)/($subpages_or)(?:/feed)?$@", $result, $path_pieces)) {
      // [group&#124;village]/[background&#124;images&#124;...]
      $group_type = $path_pieces[1];
      $group_path = $group_type .'/'. $path_pieces[2];
      $group_node = drupal_lookup_path('source', $group_path);
      if ($group_node != '') {
        $result = $group_node .'/'. $path_pieces[3];
      )
    }
...
    $result = i18n_url_rewrite($op, $result, $path);
)&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just done similar on <a href="http://demo.nabuurtest.com/" rel="nofollow">http://demo.nabuurtest.com/</a> <a href="http://feedback.nabuur.com/" rel="nofollow">http://feedback.nabuur.com/</a> (both devel sites one should be working to some degree at any moment) and did it with custom_url_rewrite. </p>
<p>To solve the i18n problem I just called the i18n_path_alias from within my custom_url_rewrite. The i18n module is quite civilised here and doesn&#8217;t create a custom_url_rewrite if there is one existing already, so no patching required there either.</p>
<p>So cutting useful bits from code you have something like:</p>
<p><code><br />
if ($op == 'alias') {<br />
  $result = i18n_url_rewrite($op, $result, $path);<br />
...<br />
    elseif (preg_match("@node/([0-9]+)/($subpages_or)(?:/feed)?$@", $path, $path_pieces)) {<br />
      // [group|village]/[background|images|...]<br />
      $group_node = 'node' .'/'. $path_pieces[1];<br />
      $group_path = drupal_lookup_path('alias', $group_node);<br />
      if ($group_path != '') {<br />
        $result = $group_path .'/'. $path_pieces[2];<br />
      }<br />
    }<br />
...<br />
if ($op == 'source') {<br />
      if (preg_match("@($types_or)/([^/\?\s]+)/($subpages_or)(?:/feed)?$@", $result, $path_pieces)) {<br />
      // [group|village]/[background|images|...]<br />
      $group_type = $path_pieces[1];<br />
      $group_path = $group_type .'/'. $path_pieces[2];<br />
      $group_node = drupal_lookup_path('source', $group_path);<br />
      if ($group_node != '') {<br />
        $result = $group_node .'/'. $path_pieces[3];<br />
      )<br />
    }<br />
...<br />
    $result = i18n_url_rewrite($op, $result, $path);<br />
)</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eric</title>
		<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/#comment-169</link>
		<dc:creator>eric</dc:creator>
		<pubDate>Wed, 16 Jul 2008 01:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://pajamadesign.com/?p=32#comment-169</guid>
		<description>Hey Jacob,
To follow up on Jeff's note, here is a  visualization of how context helps simplify site handling like blocks/menus/views/panels around it's natural IA: 
http://www.developmentseed.org/blog/2008/jun/13/wri-org-redesign-launches-using-content-ui

hope that helps the Mexican project. Te vayas bien!</description>
		<content:encoded><![CDATA[<p>Hey Jacob,<br />
To follow up on Jeff&#8217;s note, here is a  visualization of how context helps simplify site handling like blocks/menus/views/panels around it&#8217;s natural IA:<br />
<a href="http://www.developmentseed.org/blog/2008/jun/13/wri-org-redesign-launches-using-content-ui" rel="nofollow">http://www.developmentseed.org/blog/2008/jun/13/wri-org-redesign-launches-using-content-ui</a></p>
<p>hope that helps the Mexican project. Te vayas bien!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/#comment-168</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Tue, 15 Jul 2008 12:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://pajamadesign.com/?p=32#comment-168</guid>
		<description>You may want to look at &lt;a href="http://drupal.org/project/context" rel="nofollow"&gt;context&lt;/a&gt; and &lt;a href="http://drupal.org/project/spaces" rel="nofollow"&gt;spaces&lt;/a&gt;. The context package includes the context_prefix module which handles generic path prefixing and also domain handing using the strategy Earl mentions above (and we've made it compatible with i18n). What context_prefix will do is establish a context based on the prefix, then strip the prefix off the path so the rest of Drupal respond like normal to a request. So for something like 'water_campaigns/blog' this would set a context value based on 'water_campaigns' and then let Drupal respond to 'blog'.  In the views that generate content at such a callback you'd add an argument to filter based on the context, so that only appropriate content would be shown. Spaces makes this second part a bit easier by providing OG integration. Among other things it'll set an og_group_context based on a prefix, so that you only need to add the normal 'is in the current group' argument to you views and then everything 'just works'.</description>
		<content:encoded><![CDATA[<p>You may want to look at <a href="http://drupal.org/project/context" rel="nofollow">context</a> and <a href="http://drupal.org/project/spaces" rel="nofollow">spaces</a>. The context package includes the context_prefix module which handles generic path prefixing and also domain handing using the strategy Earl mentions above (and we&#8217;ve made it compatible with i18n). What context_prefix will do is establish a context based on the prefix, then strip the prefix off the path so the rest of Drupal respond like normal to a request. So for something like &#8216;water_campaigns/blog&#8217; this would set a context value based on &#8216;water_campaigns&#8217; and then let Drupal respond to &#8216;blog&#8217;.  In the views that generate content at such a callback you&#8217;d add an argument to filter based on the context, so that only appropriate content would be shown. Spaces makes this second part a bit easier by providing OG integration. Among other things it&#8217;ll set an og_group_context based on a prefix, so that you only need to add the normal &#8216;is in the current group&#8217; argument to you views and then everything &#8216;just works&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jacob Singh</title>
		<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/#comment-167</link>
		<dc:creator>Jacob Singh</dc:creator>
		<pubDate>Tue, 15 Jul 2008 10:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://pajamadesign.com/?p=32#comment-167</guid>
		<description>Hi Earl,

I looked into that, but it didn't work for me.  Furthermore, it conflicts with i18n which is a PITA...  Maybe I did it wrong, but it really did not work for me... Perhaps I used the wrong code?  Do you have an example?

Thanks for posting!
Jacob</description>
		<content:encoded><![CDATA[<p>Hi Earl,</p>
<p>I looked into that, but it didn&#8217;t work for me.  Furthermore, it conflicts with i18n which is a PITA&#8230;  Maybe I did it wrong, but it really did not work for me&#8230; Perhaps I used the wrong code?  Do you have an example?</p>
<p>Thanks for posting!<br />
Jacob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: merlinofchaos</title>
		<link>http://pajamadesign.com/2008/07/15/how-to-handle-urls-for-mini-sites-in-panels-2/#comment-166</link>
		<dc:creator>merlinofchaos</dc:creator>
		<pubDate>Tue, 15 Jul 2008 00:37:41 +0000</pubDate>
		<guid isPermaLink="false">http://pajamadesign.com/?p=32#comment-166</guid>
		<description>You can accomplish the same basic thing in custom_url_rewrite(), which is something you also should put only in a client module.</description>
		<content:encoded><![CDATA[<p>You can accomplish the same basic thing in custom_url_rewrite(), which is something you also should put only in a client module.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
