Theming links in view page

br4t - July 20, 2008 - 13:37
Project:Views
Version:6.x-2.0-rc1
Component:page displays
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Using lightbox it should be possible to load nodes in a lightbox (as in herE:http://drupal.org/node/252260)

Can i make views output my list of nodes formatted so that the /lightbox2 postfix and rel="" get inserted into the links?

#1

heather - July 21, 2008 - 00:27

I'm not sure what kind of links you mean? But yeah, you can do something like that.

If it is a node link you'd be able to use:

<a href="<?php print $node_url ?>" rel="lightframe[][<?php print $title; ?>]"><?php print $title; ?></a>

If it was like, a custom content type where you have multiple "link" fields (say with a "title" and "url") you could use something like this:

<?php foreach ((array)$node->field_link as $item) { ?>
<a href="<?php print $item['url']; ?>" rel="lightframe[][<?php print $item['display_title']; ?>]"><?php print $item['display_title']; ?></a>
<?php } ?>

- I tested those both and they work with a node-view-VIEWNAME.tpl.php ... and a row style : node selected in my theme options.

More Lightbox2 formatting options... http://drupal.org/node/252260

#2

merlinofchaos - July 21, 2008 - 21:13
Status:active» active (needs more info)

The question is two vague. There are lots and lots of different ways to have links in a view and they all have to be handled independently. Chances are the only way you can do this is to theme the view, and providing more information there requires knowing exactly what kind of style and fields you're using.

#3

br4t - July 22, 2008 - 06:21
Status:active (needs more info)» active

Hi.

I mean: when i generate a page view and that page view lists a number of nodes I would like to display those nodes inside a lightframe.
Would that be possible?

#4

br4t - July 27, 2008 - 12:12

Ok, hoping to be as precise as possible here:

I have a view (page) in which i gather a list of nodes (persons added to the database). THis list is linked, so whenever i click a person i go to their page (node).
I don't want to have to navigate away from that page, but show the node inside a lightframe.

To achieve this, i will have to be able to add the rel=lightframe to the link, and make sure that just the node is loaded inside the frame (instead of the entire website displaying the node)

#5

heather - August 5, 2008 - 12:05

did you try themeing a field? you can create field-specific theme template files.

- install the devel module, and "Enable Theme developer" (in the devel menu which appears in your sidebar).
- look at your page (or whatever your view outputs), and click on the 'link' you want to theme. devel will suggest the proper file name for making a theme .tpl for that field.
... it would look something like views-view-field--my-view--value-2.php.tpl

you can add the rel="lightbox" in the theme template. you'll be outputting an array, i gave an example above.

#6

br4t - August 8, 2008 - 11:01

Hi
Thanks for your support
I got it working :)

#7

heather - August 8, 2008 - 13:52
Status:active» fixed

cool, glad you got it working.

when you find something that works- as a final flourishing finish- you can change the status to "fixed" (how satisfying)...

... and also described exactly how you fixed it, and even paste in all the example code from the template you created.

this will help the next person who comes along!

(and i'm also kinda curious what you ended up doing)

#8

Anonymous (not verified) - August 22, 2008 - 13:54
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.