How to redirect a view to a panel page using the "more link" function of views?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by DrupalCuckoo on May 11, 2010 at 3:15pm

hi,

I'm having some trouble with Views and Panels (I'm using the latest version of both modules).

I've created a view with two "content pane" displays to list some sort of content (let's say blog entries). The first "content pane" displays the first 5 blog entries of a given user. The second "content pane" displays all blog entries of a given user. To get from the first "content pane" to the second I want to provide a "more" link on the first one.

The first "content pane" is on one panels page (which points to "/user/%user") and the second "content pane" is on an totally different panels page (which points to "/user/%user/foo"). So I have to seperate panels pages and every one carries one of the "content pane" displays from my view.

Since I've no "page" display in my view, the "more" link doesn't appear on the first "content pane" display. I don't want to create pages with views because I can't override the page's path with a page created with panels.

How is this supposed to work together? How can I link from one "content pane" display to another or to a custom panels page?

Thanks for any help.

Categories: , ,

Comments

I solved a similar problem

Posted by juliavdw on May 11, 2010 at 6:28pm

I solved a similar problem using taxonomy. My problem was that I wanted the 'more' link to go to a custom panels page, not a view or the original content node.

I had taxonomy terms for organizational use already. I made the terms correspond to the panels page path: blah.com/products/[term]

In the view, i had teh title field and description field. The description field was set to be trimmed. I excluded the description field from display. I added the taxonomy term name to the fields in use and checked "rewrite content of this field". I used tokens to reconstruct my little blurb:
[field_description]

(link tag) href="/products/[name]"

([name] is the taxonomy term name)

I'm not sure if a similar approach would help you link a content pane to another content pane, but I was pretty happy to find that this simple procedure worked for me. :)

In the

Hi Julia, thanks for your

Posted by DrupalCuckoo on May 12, 2010 at 8:34am

Hi Julia,

thanks for your reply.

I didn't try it this way because it would cause an other problem (I think).

You say you've created the "more" link by adding a "field" in views and you've altered its output to display a custom link.

This method could work if you show only one node at a time but as soon as you have more than one node to show this "more" link would be generated on every node, right? In my case I want to show the latest 5 blog entries, so every of the 5 nodes would have a "more" link, right? What I need is only one of them, preferably at the end (just like the default "more" link from views) :-). How can I approach this? I'm using taxonomy as well but not so much for organizational stuff (it's more like tagging nodes for a custom search engine).

If there's really no way to utilize the default "more" link functionality from views, how can I create a custom link which will be generated only once?

Thanks again for any help :-)

Best regards,
DrupalCuckoo

View footer?

Posted by markus_petrux on May 12, 2010 at 8:44am

You could even use custom PHP code to render the "more" link to anywhere you wish.

hi, yes I could, but it's not

Posted by DrupalCuckoo on May 12, 2010 at 8:59am

hi,

yes I could, but it's not the solution I'm looking for :-)

I mean how can you utilize Panel Pages and Views to go from one Panel Page to another Page?

If some one can give me a solution, in which I create pages with views and then use the Panels module to alter this page (created with views) I will be happy with.

hmm...

Posted by markus_petrux on May 12, 2010 at 10:30am

If I understood you well, you're in page /user/%user, and here you are rendering a view that needs a link to "/user/%user/foo". If so, the you can use PHP code for the footer page of View in page /user/%user with something like this:

<?php
print '<div class="more-link">'. l(t('more'), 'user/'. arg(1) .'/foo') .'</div>';
?>

I'm sorry but where can I

Posted by DrupalCuckoo on May 12, 2010 at 11:14am

I'm sorry but where can I insert this code? Can't find it :-(

In views I have only "content pane" displays, there is no "page" display.

The "Footer" Input field of the "content pane" display in views can't handle php code.

Enable the PHP filter module

Posted by markus_petrux on May 12, 2010 at 11:39am

It can be found in "Core - optional" modules.

If you do not want to enable this module, but you can create a custom module, you can probably override a template related to the view in first page, and there you can render the "more" link as above.

Ok thank you. I'll have a

Posted by DrupalCuckoo on May 12, 2010 at 12:10pm

Ok thank you. I'll have a look at this module :)

best regards,
DrupalCuckoo

Ok I activated the "PHP

Posted by DrupalCuckoo on May 12, 2010 at 12:23pm

Ok I activated the "PHP Filter" module and it works just perfect! thank you very much :-)

Are there any security issues with this module?

Only if you give other users

Posted by ludo1960 on May 12, 2010 at 12:54pm

Only if you give other users permission to use it

thanks!

Posted by DrupalCuckoo on May 12, 2010 at 1:52pm

I won't, I promise ;-)

It hasn't been mentioned

Posted by Scott Reynolds on May 12, 2010 at 4:11pm

It hasn't been mentioned here, but I happen to be a fan of using preprocess here.

<?php
function THEME_preprocess_views_view(&$vars) {
if (
$vars['view']->name == 'view_name' && $vars['view']->current_display = 'display_name') {
$vars['more'] = '<div class="more-link">' . l('LINK TEXT', 'panel/page/path') . '</div>';
}
}
?>

hi, sorry I wasn't able to

Posted by DrupalCuckoo on May 14, 2010 at 8:28am

hi,

sorry I wasn't able to reply to you earlier.

This function would go into the which file? Can I use this in a custom module or does preprocess functions belong to the theme?

I don't like to spread functions and settings all around. It should be in one place (i.e. in a custom module which handle various kinds of settings).

Maybe you can explain a little bit :)

Thanks.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /