[support] Is this achievable using drupal alone?

Michael Prasuhn mike at mikeyp.net
Sat Mar 15 21:23:55 UTC 2008


What I typically do when presented with this type of project, with  
multiple views per page, is to embed the views via the theme layer,  
and pass the selected argument, such as the node title into the view  
as an argument. Here's a semi-detailed break down:

Create a view that filters for images based on node type, published  
and then an argument as city name.
(do the same for blogs, writings, and any other separate views you  
want on the page)

In your theme, in template.php, in phptemplate_variable, under the  
page, or node switch, add something along these lines:

	if ($vars['node']->type == 'citypage') {
		$view = views_get_view('images_by_city');
		$vars['embeded_images_view'] = views_build_view('embed', $view,  
array($vars['node']->title), false, false);
	}

Repeat as necessary for each view that you want on the page.

Then, in your page.tpl.php or node.tpl.php (depending on which switch  
you but the above code under) you can add the following to your  
tempalte:

	<?php if ($embeded_images_view): ?>
		<div id="embeded-images-view">
		<?php print $embeded_images_view; ?>
		</div> <!-- embeded-images-view -->
	<?php endif; ?>

And repeat as necessary for each view that you want to embed.

A little code in a helper module that implements hook_nodeapi could  
handle creating a term for each new node of this type that is made.  
This can be a very elegant solution, although it can produce some odd  
results with node edit pages if you embed the view in the page template.

Hope this helps out.

-Mike



On Mar 15, 2008, at 12:45 PM, Neil: esl-lounge.com wrote:

> Thanks for the responses so far...this has certainly kept my brain  
> busy for the last couple of days and there are still a lot of  
> uncertainties in my mind. I'm not sure I understand how I would use  
> Views to present each "page" for each city with the tagged entries  
> underneath. As I understand Views, I could present a list (table,  
> full nodes or teasers) with, for example, all content tagged with  
> "Dallas, TX", but how would I alter what comes at the top of each  
> page (using, presumably the page/header text box)? I would ideally  
> like to present some type of Info box at the top of each city's page  
> (founded, population, long/lat, country/state, etc). I wouldn't be  
> able to do this with views, would I? This is also why I was toying  
> with the idea of just having a group for each city.
>
> Using CCK, I could have member enter all the Info Box fields when  
> they create each new one. Then, using my exisiting node- 
> group.tpl.php, the group page could be laid out with the info box at  
> the top of the page, the mission statement, etc, to one side and all  
> the relevant content (forum posts, blog entries, images, pagers,  
> etc) showing below. So I might have something like this:
>
> http://i29.tinypic.com/9bazyf.png
>
> Does this sound workable? What problems are there in having  
> potentially 10,000 groups? Or 100,000? How would I get them all to  
> link together (as the [category:Texas] function would allow me to do  
> in MediaWiki, for example.)? Is there any way I could use a special  
> CCK field to introduce the idea of hierarchy (United States >> Texas  
> >> Dallas >> Plano) into the group content type? Or would I need to  
> get busy with a Location taxonomy and tag each new group as it's  
> created??
>
> Again, I really appreciate any input on this from anyone, if only to  
> point me in the right direction.
>
> Neil

__________________
Michael Prasuhn
mike at mikeyp.net
http://mikeyp.net
949.200.7595
714.356.0168 cell
949.200.7670 fax




More information about the support mailing list