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

Comments

nicholasthompson’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
Assigned: Unassigned » nicholasthompson
Priority: Normal » Critical

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

SimonV’s picture

Has anyone had any luck with this?

nicholasthompson’s picture

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

lefnire’s picture

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.

xpi’s picture

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

SimonV’s picture

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.

nicholasthompson’s picture

Status: Active » Needs review
StatusFileSize
new9.5 KB

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?

nicholasthompson’s picture

StatusFileSize
new7.68 KB

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

Please review!

nicholasthompson’s picture

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.

nicholasthompson’s picture

StatusFileSize
new10.08 KB

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?

evo’s picture

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

nicholasthompson’s picture

I'll give it a go at some point.

Nick

summit’s picture

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

hawkdrupal’s picture

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.

nicholasthompson’s picture

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.

d.sibaud’s picture

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

prestonso’s picture

What is the status of this feature request in d6?

nicholasthompson’s picture

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!

PeterZ’s picture

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

carj’s picture

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

nicholasthompson’s picture

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...

Pushkar Gaikwad’s picture

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 ?

nicholasthompson’s picture

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.

d.sibaud’s picture

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

nicholasthompson’s picture

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".

d.sibaud’s picture

thks, I'll wait for the 2.0 release.

jeffabailey’s picture

subscribing

Flying Drupalist’s picture

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

nicholasthompson’s picture

It is - just needs time...

Flying Drupalist’s picture

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?

wflorian’s picture

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.

nicholasthompson’s picture

Unfortunately there is no date.... Sorry.

Augusto Ellacuriaga’s picture

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

patchak’s picture

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

summit’s picture

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

nicholasthompson’s picture

@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)....

Triskelion’s picture

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.

nicholasthompson’s picture

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.

dicreat’s picture

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

wflorian’s picture

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

SimonV’s picture

summit’s picture

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

wflorian’s picture

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

GREAT WORK!

nchase’s picture

interesting. subscribing

OnlineWD™’s picture

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.

nicholasthompson’s picture

A potential breakthrough for Views integration...

  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...

eaochoac’s picture

Subscribing too, I'm doing workarounds with these titles, Descriptions are ok with nodewords by path, but the tag for views is needed for version 6.

andyceo’s picture

subscribing.

finex’s picture

subscribing

aac’s picture

Title: Support For Views » Subscribing!!

Subscribing!!

nicholasthompson’s picture

Title: Subscribing!! » Support For Views

Please don't change issue titles...

Evariste-1’s picture

Subscribing

srobert72’s picture

Subscribe

marco88’s picture

Need that for my partners view in http://www.mega-quick-sale.co.uk/partners

Subscribing.
Marc.

Andrew Gorokhovets’s picture

First of all it is Viwes Issue. (tokens in title and header) http://drupal.org/node/673700
Viwes module should be return correct .
Page Title module certainly should be able add something in Views Title.
Something is already in function "global title".

Andrew Gorokhovets’s picture

Interesting link http://drupal.org/node/365418 (Setting the View-Title programmatically in Views2)

alex dicianu’s picture

Subscribing.
Need it badly :)

nicholasthompson’s picture

I've just committed a tweak to DRUPAL-6--2 which allows any Views Page to have a static title. NOTE: This still does not support Arguments.

summit’s picture

Hi, thanks for adding!
Will it be possible to add tokens to the static title?
greetings, Martijn

nicholasthompson’s picture

Yeah I was playing with it last night and undid some of that work and have decided that all views Title's shouldn't actually be TITLE's... but Patterns instead. It'd have the same effect as a title but would allow tokens.

summit’s picture

Great! Looking forward to it!. Is it on taxonomy and node view?
Greetings, Martijn

nicholasthompson’s picture

I've just committed some more work to the dev branch - now page display handlers can set a page title and each argument can set a page title which can use both global tokens or %1 placeholders.

However arguments are still not "context" aware, so node or term arguments are irrelevant.

summit’s picture

Hi Nicholas,

May be context awareness could me made through ctools? This is a fine way of showing content of views/panels etc.. and has context awareness.

greetings, Martijn

nicholasthompson’s picture

Sounds interesting - how would I go about that? Any examples I could read through?

summit’s picture

Hi Nicholas,

Google is your friend, may be looking into: http://drupal.org/node/537776 and http://drupal.org/node/484340#comment-2642646 for tokensupport, read whole thread to get the idea.
Would be great to have page title also work in ctools through context and this way support arguments.

greetings, Martijn

nicholasthompson’s picture

Ooo looks good - that'll be some bed time reading :-) Thanks for the pointers!

Brian294’s picture

I wrote a helper module that combines the path/token capabilities of nodewords with the page_title module. You might want to check it out to see if it helps you solve this problem:

http://drupal.org/project/nodewords_pagetitle

aaron.r.carlton’s picture

subscribing

nicholasthompson’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Needs work » Patch (to be ported)

I've been playing around with this and, as you can use the %1-type placeholders directly from the argument, I'm wondering how "relevant" contextual tokens would be to the argument. If you want the term name, then the placeholder will provide that as part of the argument (wont it?).

I've committed some fixes for the solution today and I think, for now, it's at an acceptable stage. I think I'd prefer to consider "contextual tokens" as part of a different thread as people may find that its not necessary.

Marking as "to be ported" as I need to transfer this work to the 5.x and 7.x branch.

Shadlington’s picture

Subbing.

koppie’s picture

Subscribing.

nicholasthompson’s picture

Status: Patch (to be ported) » Fixed

This is now committed to dev on 7.x-2.x and 6.x-2.x. 5.x-2.x is no longer supported.

If there are any further issues (bugs or features), please can they go in a separate/new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.