Hi everyone,
I'm using Media module (2.x dev) and I have to make a critical desicion on set-up, choosing between:
a) Set-up one media field in content type allowing both IMAGES and DOCUMENTS, or
b) Set-up two media fields in content type, one for IMAGES and one for DOCUMENTS.
If I go along with first option (a) I need to add a visibility rule in ctools pages (using panels) so that only DOCUMENTS are displayed (I'll make a similar rule for IMAGES)... Reason for this is that IMAGES are displayed above my "body text" and "DOCUMENTS" are displayed in a right block on my panels.
So, if I'll assume correctly that setup-up "a" is more elegant -- does anyone have a decent PHP-code that evalues TRUE if the file is DOCUMENT?
My attempt so far is to look at the url, I currently only allow pdf so if the url ended with .pdf it is a "document" and should pass the visibility rule. I put below code as PHP in "visibility rule" (without the <? php ?>) but it does not pass as TRUE.
<?php
substr( $url, strrpos( $url, '.' )+1 ) == 'pdf'
?>You can see for yourself what I'm doing at: http://brforesundsdammarna.se/node/20
I only want the "book1.pdf" file to show, the jpg file "4_slottsparken.jpg" should be hidden by the "visibility rule".
Really appreciate if someone could help me set this straight! :>
Regards,
Mikael
Sweden
Comments
Maybe a Views filter
investigate letting Views select for you using the filter and then use a Views Pane to show in Pages. Another thought is there a way to store the different files in different directories then use the directory as a content filter. Just a couple of things I would mess around with. I would also test your current php code without using drupal just see if it works as you hope.
Thanks for your answer. I'm
Thanks for your answer. I'm learning as I go and the views_php module is what I'll use for now (I'm aware that it's not optimal, but for the time being it will do). It allowed me to blank some fields and filter on certain rows... quick and dirty :>