conflict with argument handling code?

bsarchive - May 16, 2008 - 12:09
Project:AJAX Views
Version:5.x-1.4
Component:User interface
Category:support request
Priority:normal
Assigned:febbraro
Status:active
Description

I'm a bit stuck on this!

I'm trying to make a view block that displays node content from nodes related to the current node by a nodereference field. I've followed the instructions (I think!) and the best I can get is to get the entire page (header, side columns etc.) loading into the ajaxviews block -- not the requested views fields.

Can someone explain the role of the page view in ajaxviews? If I specify a page view (as well as the block view) and don't specify a page URL the ajaxview block never gets beyond 'Loading content for...' and if I do specify a page URL for the view, ajaxviews loads the entire page in, rather than specifically the view content.

Is my problem perhaps related to my argument handling code?, which is

<?php
$args
= array();
if (
arg(0) == 'node' && is_numeric(arg(1))) {
 
$node = node_load(arg(1));
  foreach(
$node->field_side_panel_content_tabs as $field) {
     
// ids is the array with the referenced image id's
     
$ids[] = $field['nid'];
  }
$ids= implode('+', $ids);
}

return array(
$ids);
?>

Is this removing the ajaxviews argument?

Nooby thanks!

#1

febbraro - May 21, 2008 - 16:49

Hey bsarchive, sorry for the delay.

Can you paste here the script tag in your head that is doing the $.get()? That will help me see what is going on, at least initially.

As far as how this all works, you need to specify a page URL, that is the only way the block knows how to dynamically grab the contents via AJAX. I have seen some cases where if there are no results returned the entire page gets displayed. With the url in the $.get you can put that directly into the browser to play with what happens when various arguments are used.

Also, I just released an update that more properly handles view arguments. Also for your arguments that are optional be sure to specify a wildcard like * or something.

#2

febbraro - May 21, 2008 - 16:50
Assigned to:Anonymous» febbraro

#3

bsarchive - June 3, 2008 - 13:35

Thanks for getting back to me.
The script is
$(document).ready(function() {
$.get('/sca/ajax', {page: 0}, function(data, status) {
$('.ajax-view-block-sidebar-content2').html(data);
});
})
but then only when I have no other arguments in the view. If I add an argument, even with no argument handling code, the block doesn't render and the jscript is absent from the head.

I've tried doing a print_r($args); but with no luck. What is the ajaxviews argument and where's it meant to go?

Also, I can't get the ajaxview block to render any node fields other than the title, despite having more fields listed in the view. ?

Many thanks for your help!

#4

mavimo - June 7, 2008 - 18:31

What version of ajax_views do you are using?

#5

bsarchive - June 9, 2008 - 11:53

version 5.x-1.4

#6

febbraro - June 9, 2008 - 20:11

The AJAX views argument is /ajax and it is added in the arguments wherever it is specified in the ordering. Have you specified "Return all values" and a wildcard for your arguments even if they are not present? or did you specify "Page not found"?

#7

febbraro - June 9, 2008 - 20:12

With respect to your question about more node fields than just the title, follow http://drupal.org/node/211647 as that is a known limitation and will most likely be ironed out there.

#8

valcker - June 17, 2008 - 13:56

Didn't want to create a new ticket because the problem is very similar.

Let me describe the problem: I have a view page that displays nodes connected with current via nodereference field. I'd like to have a block with ajax pager that will display that nodes. Everything seems to be simple: I followed all instructions, created ajax_views block but... It seems that function _generate_ajax_url(...) doesn't handle php arguments.

According to this argument code:

<?php
if (arg(0) == "node" && is_numeric(arg(1))) {
 
$node = node_load(arg(1));
  if (
$node->type == "some_node_type") {
    return array(
arg(1));
  }
}
?>

real url of view is: my_nodes_page/[nid], so, ajax_views url should be: my_nodes_page/ajax/[nid]. When I go to "my_nodes_page/ajax/[nid]" it shows me nodes related to [nid], so everything is just fine here. The problem is that _generate_ajax_url(...) doesn't generate proper URL.

Do you have any suggestions on how this can be fixed? The module is just great, I would not want to replace it with something else in my project.

Thanks!

#9

valcker - July 22, 2008 - 08:53

ping?

 
 

Drupal is a registered trademark of Dries Buytaert.