I'm not sure how to frame this question, so I'm sorry if the answer already exists.

Basically, I want to know how to modify the way arguments are fed into views. For example, say I'm presenting a income statement and balancesheet, it seems like its formatting the links as www.example.com/balancesheet/ibm and www.example.com/incomestatement/ibm

Is there a way to make it www.example.com/ibm/balancesheet or www.example.com/ibm/incomestatement, so I can create views and have them grouped this way?

My problem is instead of grouping content by views, I want to try to group views by content so if someone searches for IBM they basically get all the views that apply. I'm open to any suggestions anyone has.


Each item between the slash after the domain name of the website is called an argument. Take, for example, example.com/one/two/three/four/five -- in this case one is the first argument, two is the second argument, ect.. Drupal has a function that separates these arguments named arg() which takes an argument as a number. arg(1) when called while loading this example URL will always return 'one' while arg(5) will always return 'five'. This way context can be passed into all the modules in a consistent way. I just want to make sure you see arguments for what they are.

Here is why. You are creating a two separate pages for items that should be on the same page. Instead of creating pages you might consider blocks in views and place the many blocks on the same page. This way you can, for example, use taxonomy terms to tag content as IBM, Intel or Apple. Create a balance sheet and tag it IBM. Create another tag it Apple. Create an income statement and tag it IBM. Create another and tag it Apple.

Then create a basic page with a brief description of the IBM corporation and a logo using the path alias module to change the name of the URL to example.com/ibm. Then add the two views as blocks to the page. Each view will be called when the user goes to example.com/ibm and arg(1) will be ibm. Then you can use the arguments (in View 3 contextual filters) to use this argument to define the Taxonomy term to filter the information in the database with. In this case IBM. Now you might have 12 reports for IBM for each category going back 4 years. Views will pull them all and you can use a field of title that links to the node to have a link going to each one. Then you can also use the date filter to make sure that the most recent one is on top. Once the View block is created, Views will just load the other view using once again arg(1) to define the taxonomy term to find all the other reports information in the database.

Now there are more advanced ways to trigger which Views get called with modules like Context or Panels which are super high powered tools that focus on just this simple purpose. You might be interested in the videos on Panels at Node One or the Mustard Seed Media video on the Context module.

(edit) To create a similar tabbed look like companies on the WSJ you can use either Quick Tabs for an ajax tabbed effect or creating a Views page and assigning it a Menu Tab for the menu item so that several tabs are found on the same page.

|improve this answer|||||
  • Hey Thanks so much Adam. I'll look into this, not 100% sure if it'll work as my firm has about 15 years worth of company research that we're trying to post online. Creating individual first pages for each company would cause alot of extra work for me, plus they are adding companies all the time I wouldn't want them to have to get IT's help everytime they finish researching a new firm. But we want to eventually get community feedback around it so I might have to go this route(since I'm not sure if I can add comments to views). – Lostsoul May 20 '11 at 5:40
  • Well, I just made up a very arbitrary example. Building Views and using arguments and relationships is an art form so it takes practice. You would of course do something such as make a content type that functions as the base for each company. Then you would use one of the many different solutions for importing information into a Drupal database to create as many of the pages for each company that you need. If you have a lot of data in spreadsheets you might want to look at the Data module with the Table Wizard. This way you can have tabular data that is also made available to views. – Adam S May 20 '11 at 7:02
  • 1
    @lostsol, you only need to create one template which has the company name as the argument. I'm working on a similar sounding project in the uk so mail me if you want some more general collaboration. – Jeremy French May 20 '11 at 7:29
  • Awesome thank you Jeremy. I'll get cracking on this over the weekend and reach out to you. I should hopefully be done but I think I've gone through almost every problem possible so maybe I can help and I'm sure you'll see flaws in my approach and have improvements suggestions. Thanks so much. – Lostsoul May 20 '11 at 15:38
  • Thanks Adam. I am using data to access an external database which has all the data in it. Table Wizard was easier but didn't seem to do the joins correctly..I think presending the data is good now just looking for cool ways to present it. I'm going to work on your suggestions today and let you know the result. Thanks as always for your suggestions and insight. – Lostsoul May 20 '11 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.