Submitted by madmatter23 on Mon, 08/20/2012 - 13:16
Embedding a view programmatically is not too difficult, but what about passing it a value for an exposed filter? This snippet gives a simple example of how to modify the View object in a more meaningful way before rendering it.
Submitted by madmatter23 on Tue, 07/31/2012 - 19:21
Learning to use the Views module from the front end of Drupal is a daunting task, but you can rest assured that many others struggle along with you. There are many tutorials and screencasts dedicated the the subject. Tackling the Views API from the backend, however, is a bit more of a challenge. It's not easy to document the behemoth that is Views, and hence, the documentation is limited.
This blog post is the first of a series that will explore the Views API from the backend-- from the code. Clearly, it's not going to be possible for me to give examples of all the various ways that you can integrate with Views. My goal is to provide you with a general understanding Views, and to give you the same tools that I use to tackle the beast. Namely, a methodology for figuring things out on your own. If you're a developer looking to integrate your module with Views, or if you'd like to build custom Views handlers for your site, then stay tuned.
Submitted by madmatter23 on Wed, 08/17/2011 - 17:25
Views replacement patterns are great, but they take up valuable variable real-estate. If you need to literally output "[nid]" rather than the value of its corresponding replacement pattern, you might start hitting your head against the wall.
I found this issue to be particularly annoying when using the Prepopulate module, which required CCK field names (with bracketed arrays) to a URL.
Never fear! Rather than using "[nid]" in your views text, try using percent encoding rather than literal brackets. The result would be:
%5Bnid%5D
Using percent encoding with stop views from replacing the replacement pattern with a dynamic value.
Submitted by madmatter23 on Wed, 08/10/2011 - 13:49
You may notice that after downgrading, you receive and error like:
Unknown column 'view_php' in 'field list' query:..sites/all/modules/views/includes/view.inc on line 1722.
If so, backup your database and then run this mySQL query:
Submitted by madmatter23 on Fri, 07/01/2011 - 11:58
I tossed around a lot of strategies for accomplishing this, and in the end I managed to find a module that does most of the hard work for me.
Goal
To create a node which displays the teasers of all its menu children (other nodes nested under current node's menu entry).
Submitted by madmatter23 on Wed, 04/13/2011 - 20:15
Goal: create link that goes to a new page and opens a specific accordion drawer.
Using the Views Accordion module in combination with a little custom code accomplished this. Here's a step by step guide.
Create your view
-add this header with input filter "php code":
Submitted by madmatter23 on Wed, 04/13/2011 - 18:46
Often times, you may want to customize the appearance of a views field, or perhaps add a bit of logic to the output. You can customize the display of any field in Views by utilizing the Views Customfield module.
Here's an example of how to breakdown a basic cck fieldfield into its constituent parts.
<?php
//print var_export($data, TRUE); //prints out all available fields in view
$value = $data->node_data_field_document_field_document_fid; //relevant fid
Recent comments