Support For Views

irstudio - September 19, 2007 - 17:40
Project:Page Title
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:nicholasThompson
Status:needs work
Description

it would be nice to be able to specify a different page title for views as well

1) line 194 of the module would have to say
if (drupal_is_front_page() || !$page_title) {
because the view might not have a drupal_title

2) i suppose a form alter for the view edititng page would be needed as well

3) also an extra column for the page_title table to handle vid

4) not sure, but there has got to be a way to hook into the view load operation and set the page title

#1

nicholasThompson - September 20, 2007 - 22:04
Version:5.x-1.x-dev» 5.x-2.x-dev
Priority:normal» critical
Assigned to:Anonymous» nicholasThompson

Interesting idea! Should be fairly easy to do - I'll look into how Nodewords handles meta data for almost all page types...

#2

SimonV - January 7, 2008 - 18:11

Has anyone had any luck with this?

#3

nicholasThompson - January 7, 2008 - 21:36

I haven't had time to look at this yet. Its something I'd like to integrate into PageTitle2...

#4

lefnire - January 11, 2008 - 18:35

bump, quite a silently in-demand feature, actually! I thought it sounded like a must have, so i talked to other SEO-savvy drupallers to see how they've been getting by without it... most have been doing work-arounds, like getting the PHP code for a view, pasting it into a new Page from which they CAN control the page title.

#5

xpi - January 21, 2008 - 00:58

i need that too.
i use 'title' with pathauto in mind,
'page title' is exactly that what i want to display.

#6

SimonV - January 30, 2008 - 21:18

My work around is much simpler. Check out the Insert Views module (http://drupal.org/project/insert_view). Although it is very easy to just make a page and display a View within it, it's a few extra steps and it would be great to see Page Title exposed to Views.

#7

nicholasThompson - February 5, 2008 - 22:04
Status:active» needs review

I attach a patch which has been lightly tested...

Feedback needed and appreciated.

Basically this patch adds a field to the page fieldset of a view where you can set the Head Title of the view. The patch also reworks the way the the module stores the page titles - so upon patching you will need to run a database upgrade. DO NOT TEST THIS ON LIVE! The database update changes the ID field from 'nid' to 'pid', adds a new column called 'type' and recreates the primary key.

What probably needs doing is defining either a default view token template and/or a token template for all views. Maybe (just as a thought) the Head Title should also allow tokens too? This might allow you to say [term-name] in the Head Title which would make things like the taxonomy/term override better... But the issue is making the token_replace aware of the scope (node, taxonomy, user, etc).

Anywho - thoughts?

AttachmentSize
page_title_meets_views.patch 9.5 KB

#8

nicholasThompson - February 18, 2008 - 17:47

Here is a second patch with fixes/improvements. It is also re-rolled against ALPHA5....

Please review!

AttachmentSize
page_title_meets_views_again.patch 7.68 KB

#9

nicholasThompson - February 19, 2008 - 10:18
Status:needs review» needs work

I have noticed some errors in the patch and am working on this right now... will post another patch later this morning.

#10

nicholasThompson - February 19, 2008 - 17:15

Ok, more fixes are here...

Checkout DRUPAL-5--2-0-ALPHA5 version of PageTitle, patch it with this patch and then run update.php as this required changes to the database table.

DO NOT RUN THIS ON A LIVE SERVER!

Each view will now have a field called "Head Title" where you can provide the title for the View. You can use tokens in the head title... So, for example you could define the View Head Title as "Term: [cat]" which will cause every "taxonomy/term" page to use the term name in the title...

Apart from testing this and providing feedback, one thing that we need to figure out is how to handle arguments as tokens... The way I am doing it right now is I am checking all the arguments that the view can take against all the arguments provided and doing one token_replace on each one - although currently its only programmed to handle the "taxid" argument.

Thoughts?

AttachmentSize
page_title_meets_views_again2.patch 10.08 KB

#11

evo - April 27, 2008 - 17:17

Hi Nicholas, thanks for the patch. I tried it on alpha5 and ran update.php but the views page title do not work it displays the default patterns. Perhaps I copied the patch incorrectly, if possible can you please upload the full install and module files including patches?

Thanks

#12

nicholasThompson - April 29, 2008 - 09:48

I'll give it a go at some point.

Nick

#13

Summit - June 21, 2008 - 10:12

Hi, any progress in this field please?
greetings,
Martijn

#14

hawkdrupal - June 27, 2008 - 17:05
Version:5.x-2.x-dev» 5.x-1.x-dev
Component:Code» Miscellaneous

Views are essential to a well-structured Drupal site. BUT...

The biggest problem is that while a view generates a web page, it doesn't provide the same control over it that is available in any normal node/page. That's a huge shortcoming, easy to see from the many postings here and elsewhere about hacking views.

The Page Title module is also essential. So, modifying it to handle views is an urgent need.

#15

nicholasThompson - June 30, 2008 - 13:28
Version:5.x-1.x-dev» 5.x-2.x-dev
Component:Miscellaneous» Code

It is an "in progress" part of the DRUPAL-5--2 branch which is currently an "in progress" snapshot... I'm working on it but dont have a massive amount of free time at my disposal.

#16

tourtools - July 31, 2008 - 08:31

subscribe, I need too this very useful patch ;-)

#17

prestonso - August 8, 2008 - 14:43

What is the status of this feature request in d6?

#18

nicholasThompson - August 8, 2008 - 15:55

It's (for me at least) "in progress when I have a spare day"

If anyone here is headed to DrupalCon Szeged - I'd be interested in having a chat with you about this!

#19

PeterZ - August 23, 2008 - 09:31

+1 for this request. This would be really great!

#20

carj - August 23, 2008 - 09:35
Title:Support for views» Help on views

I created a table views. it shows an error message for anonymous user while it's working fine for authenticated users.
Here is the error message: » warning: Invalid argument supplied for foreach() in :\hshome\myname\modules\views\theme\views-view-table.tpl.php on line 22.

Even if I configured the block to be visible for both.

Thanks

#21

nicholasThompson - September 25, 2008 - 16:37
Title:Help on views» Support For Views
Priority:critical» normal

Moving this down to a normal priority as the "patterns for paths" issue (#289389: Advanced token replacement based on path for page titles) would be a quicker and easier solution in the immediate future until I get a chance to play with Views 2 more...

#22

poseidon123 - September 29, 2008 - 22:28

Hi, WHat is the status of this ? I am running drupal 5.x and certainly needs this module to get rid of that sitename in views titles. any suggestions ?

#23

nicholasThompson - October 1, 2008 - 09:22

Using Page Title 2, you can configure the "default" Page Title pattern to be just the [title] or [page-title]. This will remove the Site Name from all pages, including views.

The "Support For Views" issue is actually so people can define a View Title and a View Page Title separately.

#24

tourtools - October 13, 2008 - 15:30

So, I didn't underststood, in tha release candidate 2.0 there will be this feature?
Hoping so,

#25

nicholasThompson - October 13, 2008 - 15:34

The problem with implementing Views page title's is figuring out the scope of the View (is it a view of nodes by user, taxonomy, date, location... etc).

Page Title 2.0 will contain a feature to configure page titles for a URL based on certain token "scopes"... It's a "work in progress".

#26

tourtools - November 10, 2008 - 11:12

thks, I'll wait for the 2.0 release.

#27

jeffabailey - November 24, 2008 - 15:14

subscribing

#28

Flying Drupalist - January 2, 2009 - 01:27

Hi, is this in the cards for 6.x? Thanks.

#29

nicholasThompson - January 2, 2009 - 01:59

It is - just needs time...

#30

Flying Drupalist - January 2, 2009 - 20:31

Thank you, but currently views titles is completely f'ed up. Is there a way to restore titles to doing the default thing but for views only?

#31

wflorian - February 8, 2009 - 14:31

Is there a date when we could a expect a version of "Page-Title" with Views integration? I am sorry for not beeing a helpful hand but my PHP knowledge is very limited.

#32

nicholasThompson - February 8, 2009 - 14:32

Unfortunately there is no date.... Sorry.

#33

GlobalFusion - April 25, 2009 - 08:02

Subscribing! It'll be nice to have that functionality since hacking views can be a pain at times.

FYI, the easiest way I found to deal with different page titles and view titles is by inserting the view into a page node. Just follow this instructions http://drupal.org/node/336097 and optimize the page as if you were optimizing it with the page title and meta tags modules :)

The following snippet unfortunately did not work since it changes both titles:

<?php
drupal_set_title
("YOUR_TITLE_HERE");
?>

If you have any other php hack, please share it. Thanks

#34

patchak - May 9, 2009 - 12:43

Is there any feature to at least a page number on views pagers now for d6??
Thanks

#35

Summit - May 22, 2009 - 13:46

Hi,

It would be great if the views-title would be supported by page_title. This way theming the termtitle, nodetitle and viewstitle would be better equiped through pagetitle!
Greetings, Martijn

#36

nicholasThompson - May 22, 2009 - 16:27

@patchak: Page Numbering is coming... Waiting for #224262: Add Page Number token...

@Summit: Not sure what you mean. View's title gets set through drupal_set_title() which in turn is picked up by Page Title if the page is not a node, term or user (or front)....

#37

triskelion - May 25, 2009 - 00:25

Views picks up the default title defined by page title. The page number patch for D6 tokens is two lines of code and works fine with D5. I now append the page number to the default pattern which means all my titles will have a 1 at the end, unless a pager is active (eg in views).

Views integration would mean I could restrict the token to views with an active pager, and I might be able to include tokens for filter terms on a case by case basis.

#38

nicholasThompson - May 25, 2009 - 11:59
Version:5.x-2.x-dev» 6.x-2.x-dev

I see! So you'd like to specify different View token patterns...

I'll take a look at some point.

#39

dicreat - September 12, 2009 - 18:11

Any worked solution for use Page title in Views?
Thanks.

#40

wflorian - September 12, 2009 - 20:41

As far as I know: No! Also still looking for working solution!!

#41

SimonV - September 29, 2009 - 20:06

#42

Summit - September 30, 2009 - 06:53

Hi, will you put your module also on drupal.org? Thanks for building this!
Greetings, Martijn

#43

wflorian - October 20, 2009 - 08:59

AWESOME!! Thank you so much! I will give it a try this week! Coming back for feedback!

GREAT WORK!

#44

snicers - October 22, 2009 - 10:52

interesting. subscribing

#45

OnlineWD™ - November 13, 2009 - 03:46

Subscribing need badly. Not sure if #41 works with latest version of node words as latest version makes meta by path obsolete and besides Page Title by Path is for Drupal 5, need a 6 solution.

#46

nicholasThompson - November 23, 2009 - 23:27

A potential breakthrough for Views integration...

<?php
 
elseif (($menu_item = menu_get_item()) && ($menu_item['page_callback'] == 'views_page')) {
   
$args = $menu_item['page_arguments'];
   
$name = array_shift($args);
   
$display_if = array_shift($args);

    if (
$view = views_get_view($name)) {
     
$view->set_display($display_id);
     
$view->pre_execute($args);
     
$title = $view->get_title();
    }
  }
?>

I added this to a test site in page_title_get_title. This allows Page Title to correctly pickup the title generated by Views when you're on a page with an argument. Now all we need is to add a field to the argument panel + a function to the object to get the data processed and returned! Hmm...

 
 

Drupal is a registered trademark of Dries Buytaert.