help with drupal views

Events happening in the community are now at Drupal community events on www.drupal.org.
gobinathm.php's picture

Hey people,

I'm working with drupal views and im new to drupal. I did exported the views and creating a widget with that exported views. I have no idea how to pass argument to that exported views.

http://pastebin.com/YzzzLEbW

i just want to pass url args and filter the views result accordingly and also pagination too.

if i pass ?page=0,1 in url it wont reflect any change.please help me with this.

if you like to contact mgobi.php AT gmail.com

Thanks,
Gobi.

Comments

u didnt have to export the

rajarju's picture

u didnt have to export the view to work with it
Once you had built the view you can call it inside ur module with the view name

u can use custom function which can get the page arguments and then pass it to a view

$arg = array();
$view = views_get_view($view_name);
    if (($view)) {
        //To select a display that you had created
        $output = $view->execute_display('block', $arg);
    }

    return $output;

Hope this helps
Aj

rajarju

Views Module provides this functionality

anil614sagar's picture

Hi gobinathm,

No need to create any custom code to achieve the functionality you required. You can use the views itself to get the job done.

You can find a section called arguments in view edit page at the middle column centre row. You can add the arguments according to your need.

For example if your output is set of nid's to filter from your argument then you can take the argument as node id and by adding argument. You can do this by clicking on plus icon next to Arguments section and select argument as node id and check the option provide default argument and select node id from url.

For more details please refer this. http://drupal.org/node/373716

Cheers,
Anil Sagar,
Sr. Software Developer,
SourceN India Pvt Ltd,
www.sourcen.com

hey anil

gobinathm.php's picture

Thanks for reply,

Actually the main idea of the concept is i have to show the final output of our views page as a embed javascript widget which can be embed any where in html pages. And well the views i did in admin works like charm as you said. But ma widget is the problem for me and ma client keep on asking for this widget must be in drupal views :(

check it out http://groups.drupal.org/node/92104

For this i guess you could

rajarju's picture

For this i guess you could just theme the view. Also you can used the preprocess functions for the views to add ur custom js

rajarju

well thanks

gobinathm.php's picture

Sorry i have to mention this that im drupal newbie and well thanks for your try to helping :) have a great day arjun

no problem bro, sorry that i

rajarju's picture

no problem bro,

sorry that i have been throwing too many things at you.

There are many ways in which you can integrate a widget with a drupal site, be it a flash or HTML based widget

Easiest way would be to theme the view

All views use a set of templates or so called tpl files.

The base files used by all views can be found inside the views module folder.

You have to copy and rename them in so that ur view will take it up.

you can find the details about renaming them in the views ui page

i would suggest you take some time to learn this thing. This is kind of tricky.

There is a book called pro drupal development. it the best available, got good tuts for theming and module development ..

Cheers :)

rajarju

hmm great geek

gobinathm.php's picture

Thanks Bro,

i know you are geek why cant i find ur chat id other than skype may be yahoo gtalk :) if you wish send me thro personal msg

hmm great geek

gobinathm.php's picture

Thanks geek,

I why cant you suggest me thro yahoo gtalk other than skype [its not allowed here ] so will catch up quickly and get clear suggestion. If you wish post some ids by perosnal msg

1st i dont like to be called

rajarju's picture

1st i dont like to be called a geek

ur callin me so cos u have no idea about wad i do :P

find me on skype, that will be the best way to to contact me.

naughty_dave

I am not regular on gtalk

But am active on facebook

rajarju

anil614sagar's picture

You said you can get the view output right.... So get that output in the format of xml and use that xml output in your js widget by calling url of the view to catch xml dynamically. In this way you can solve the problem... let me know if the below links help you.

Views Bonus Pack http://drupal.org/project/views_bonus
This module provides a number of additions to views including an XML output. This module is actively maintained and provides a number of excellent additions for getting data out of Views.

Cheers,
Anil Sagar,
Sr. Drupal Developer,
SourceN,
www.sourcen.com
Drupal- Bangalore User Group

Is sorting,filtering,etc works using view bonus?

gobinathm.php's picture

Thanks anil,

people already suggested this but i got question

Is sorting,filtering,etc works using view bonus?

India

Group notifications

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