HI All,

Am curious if I can create one view that does a lot of what I need. I'm setting up a new site with 3 project sections.

web, photography, vfx (visual effects)

i've made a new CCK content type called project and created a vocabulary called project which contains 3 terms, web, photo, vfx.

I have also ,made 3 unique pages, called, you guessed it, web, photo, vfx. these pages will be used as archives to display project entries relating to each category.

So, instead of making 3 separate views that filter the project nodes by terms to each page, I was wondering if i could set up a smart views filter that would essentially do this:

if pagename = photography - filter by terms photography
if pagename = web - filter by terms web
if pagename = vfx - filter by terms vfx

Then i would have just one views block assigned to each of the aforementioned pages and the correct content would show up.

Hope that makes sense. If anyone has done something along these lines. please let me know.

regards

Hixster

Comments

hixster’s picture

Think I may be able to do this with the relativity module, but haven't yet succeeded, any help much appreciated.

rgs

M

Drupal Web Designers Surrey South East England www.lightflows.co.uk

nevets’s picture

I would just make views :)

hixster’s picture

I am using views, I just want one view that serves multiple pages, not 3 separate ones.

Drupal Web Designers Surrey South East England www.lightflows.co.uk

matkeane’s picture

Hi,

I think you could do this with Views arguments. If you create a URL for your Views page at, say, 'projects/%' and then add an argument for Taxonomy term, you would be able to have one View serving the appropriate content at projects/photography, projects/web & projects/vfx. And if you add new terms to the vocabulary, the View will work with those as well. I think, by default, the Taxonomy term argument uses numeric Tids, but you can change the options to use the term name.

hixster’s picture

Sounds like that would work. Haven't had much luck with arguments yet, but I'll give that a try.

thanks

Drupal Web Designers Surrey South East England www.lightflows.co.uk

hixster’s picture

Thanks Mat, that did the trick, now I can serve multiple pages all in the same style and it's super easy to maintain.

Thanks for the help.

Hix

Drupal Web Designers Surrey South East England www.lightflows.co.uk

hixster’s picture

So, got the views arguments working, but would like to replace the title view (which is the taxonomy tid) with something a little more elaborate and descriptive (my terms are short, web, photo, vfx ) etc . Would like to use longer page titles to help with SEO.

Any clues on how to do that?

Hix

Drupal Web Designers Surrey South East England www.lightflows.co.uk

matkeane’s picture

Hi,

Ermmm, I think the only way I found around this was to modify the 'title' $var in the page_preprocess function of my theme template - with a whole bunch of switch statements picking up different content-types and taxonomy vocabularies. It isn't pretty, or especially easy to maintain, but it works!

Some of the Views arguments allow the input to be transformed for use as a title. I guess you could open an issue for the Views module and ask whether maybe the corresponding Taxonomy term description could be used instead of the term itself?

hixster’s picture

that's a similar conclusion I came to in the end, I just made a custom page template for the projects (page-projects.tpl.php) and added the switch stuff to the top of the page.

thanks again for all the help

Drupal Web Designers Surrey South East England www.lightflows.co.uk

smeyer56’s picture

Hix,
Can you give more details on how you did this? I see lots of questions like this with very few responses. I am trying the same thing and cannot get it to work.

I need to serve multiple pages all in the same style based on current node title.

Thanks

smeyer56’s picture

I got this to work as pages but would like to use this for blocks. Is this possible?

hillaryneaf’s picture

How did you get it to work? It would be great if you could post a quick how to.

hillaryneaf’s picture

If anyone comes across this post... here's a quick how to.

My situation was as the views exposed filter is changed by the user (to eLearning or Instructor Led Courses), the page name needs to change.

1. Create a page template file (views template file will not include the title) for the page view
2. In place of
print '<h1>'. $title .'</h1>';
put

<?php
				$current_path = ($_SERVER['REQUEST_URI']);
				if ( preg_match('/eLearning/', $current_path)){
					print '<h1>eLearning Courses</h1>';
				}
				else if ( preg_match('/Instructor/', $current_path)){
					print '<h1>Instructor Led Courses</h1>';
				}
				else {
					print '<h1>'. $title .'</h1>';
				}
			  ?>