Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ranavaibhav’s picture

1+ This will be helpful feature

nicholasThompson’s picture

Status: Active » Postponed (maintainer needs more info)

Really? Could someone explain a use-case where you'd want to list node's by their Page Title rather than their Node Title?

dicreat’s picture

For example, page title can be used as an additional short teaser for node. When you build a block with short titles it's really helpful feature.

greg.harvey’s picture

Ok, +1 here...

Example - my client is using Page Title to allow shorter breadcrumb (via Custom Breadcrumbs) and page titles but still allow long rambling ones in their News section - here's an example:
http://www.economistconferences.co.uk/news/risk-summit-dan-gardner-impor...

The token allows this to work with Custom Breadcrumbs, which is great. Trouble is, we still have the long rambling ones on the News main page, but we'd like to use the shorter ones:
http://www.economistconferences.co.uk/news

So Page Title as a Views field would be really useful. I'll probably end up writing this in the next couple of months, if someone doesn't beat me to it. Naturally, I'll post back if I do.

srobert72’s picture

Subscribe

FiNeX’s picture

It could be useful even from an admin point of view.

ptitb’s picture

Could be useful indeed. I would like to use it to export a Word doc with all nodes with the pagetitle and nodewords included.
As a content overview document to use when rewriting texts and as SEO document/handout.

greg.harvey’s picture

At last, patch for review! Adds a new field handler for Page Title, including an option to fall back on to the node title if the Page Title is not populated. Also provides a filter and an argument, using the node handlers provided by the Views module.

Edit: In case you saw previous edits, ignore, use this patch, it's fine.

greg.harvey’s picture

Status: Postponed (maintainer needs more info) » Needs work

Output works in 'preview' of views admin but breaks when it outputs the mark-up. New patch to follow.

greg.harvey’s picture

Status: Needs work » Needs review

I take that back, it works great. My theme templates were at fault. Please use #8 and test away!

greg.harvey’s picture

New patch, just tidying up after this review via matason on IRC:

gregharvey: patch works well, I got some offset message when applied to a CVS checkout etc and there's a couple of minor formatting issues: 4 spaces before 'api' in your hook_views_api() function and some whitespace on the second line of that functions comment and that also of the first comment in views_handler_field_node_page_title.inc and perhaps you'd want a @file in there too

No functional difference, just tidier code against the dev snapshot.

matason’s picture

Status: Needs review » Needs work

Looks like the paths in the second patch file header are absolute?

--- Desktop/page_title/page_title.module  2010-05-24 01:01:21.000000000 +0200
+++ Desktop/page_title_new/page_title.module  2010-08-12 18:59:22.702443072 +0200
matason’s picture

Status: Needs work » Reviewed & tested by the community

Ah okay, -p to the rescue - the patch applies cleanly if you place it in the page_title module directory and run:

patch -p 2 < 595700-page_title_views_field-2.patch

Good work @gregharvey, looks good and works well!

As an aside, I was also getting the "warning: Invalid argument supplied for foreach() in page_title.module on line 956." while testing which is a separate issue at http://drupal.org/node/818194 - I'll knock up a quick patch for that.

greg.harvey’s picture

Bugger, forgot to tidy up the paths. Sorry. Thanks for testing! =)

greg.harvey’s picture

Paths fixed, to make it easier for the maintainer to apply the patch. Should apply cleanly without any patch gymnastics with this one. No code change since R&TBC, so no need to re-review.

dicreat’s picture

I have strange error after applying patch and flushing cache: PHP Fatal error: Cannot redeclare page_title_views_api() (previously declared in /sites/all/modules/page_title/page_title.module:587)
in /sites/all/modules/page_title/page_title.module on line 585"

In page_title.module all seems to be fine:

585 function page_title_views_api() {
586   return array(
587     'api' => 2,
588   );
589 }

Hmm...

nicholasThompson’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to DRUPAL-6--2, Just need to port it to 7.x and 5.x...

I also added a default admin view which lists all the node page titles. Can be found under the admin > reports section of the site.

Thanks to everyone for this patch - particularly Greg and Matason. I love the Drupal community :-)

tyler-durden’s picture

Sorry, I just stumbled upon this and installed it but can't get it working. I upgraded from the stable 6.2.3 to the 6.x-2.x-dev dated 8/26/10. What should I see different, as I don't see any new field in my views admin? Thanks for any clarification.

greg.harvey’s picture

You should see a new field in your Views admin. Have you cleared all caches, including the Views cache (see Views Tools menu)?

tyler-durden’s picture

I have cleared all cache including the views cache and do not see it. I am using "Views 6.x.2.10", is the supported Views? I do not see inthis thread which Views version is supported with this.

Also there is a "Page Title Views SimpleTest" module, I have enabled this but do not see anything. What is this supposed to do? Thanks!

greg.harvey’s picture

FileSize
65.5 KB

Any Views 2.x is fine. SimpleTest is just for testing changes, you don't need it.

That is very strange. You should see a Page Title field like the one in the PNG attached. The code is there in the dev snapshot.

tyler-durden’s picture

Hot dang now I am excited! I was looking for the field to already be on the Pages which I already had created, but now I see you need to create a new display. This is going to rock, how stable is it to use ??

greg.harvey’s picture

100% stable.

Edit: That bit anyway - I'm not vouching for the entire dev snapshot, but the view handlers are fine. There's a filter and a sort too.

tyler-durden’s picture

Sweet, thanks! I'll do some heavy testing before using it...

Shadlington’s picture

Subbing

andypost’s picture

Views 3 now have pluggable display extenders #681468: Create pluggable display extenders

Suppose page_title should implement it's own extender and discard current implementation of own display type