Posts Tagged drupal
Custom sql queries in Views
I came across this when i was looking for a way to use my own sqly queries in combination with views.
Sometimes you can’t always get the things you want by using views (or you’re too lazy to fiddle around with arguments, relationships, etc.)
The idea is simple :
1) test your own custom query in phpmyadmin for example.
2) create a view and save it. You don’t have to set any filters since the SQL will be overwritten.
2) if you haven’t created your own module yet, create one now and place the following code in it. replace MYMODULE by the name of your own module and VIEW_NAME by the name of the view you’ve just created. Then, change the sql query you see here by your own.
function MYMODULE _views_pre_execute(&$view) {
//drupal_set_message(’—->>>’.$view->name);
if($view->name==”VIEW_NAME”) {
$view->build_info['query']=”SELECT vidnode.nid as nid, vidnode.title as title
FROM node vidnode WHERE vidnode.type=’ptl_remotevideo’
AND vidnode.status <> 0
AND vidnode.nid NOT IN (
SELECT DISTINCT media.field_media_video_ref_nid as video_nid
FROM content_field_media_video_ref media
)”;
}
}
That’s it. I used a node view and it gave me what i wanted. I didn’t have time to check out other settings but i guess it shouldn’t be too hard.
full screen swf flash background
The problem:
For a project we were trying to make a Drupal based site a bit more attractive, by adding a full screen flash background.
The SWF had to scale with the browserwindow - and stay fixed in the window during scolling.
The solution:
HTML:
Make sure the flash div comes first - otherwise it won’t work.
since this solution doesn’t work in IE6 (go figure) - we only embed the swf when your browser is greater than IE6
<!--[if gt IE 6]><!--> <div id="flash"> place your swf here </div> <!--><![endif]--> <div id="wrapper"> your sites content </div>
Â
CSS:
We position the flash div fixed to the upper left corner of the . This way the flash stays on the same place while scrolling.
The Z-indexes make sure the Flash div is positioned behind the website content.
#flash {
background-color: #000000;
height: 100%;
position: fixed;
top: 0;
width: 100%;
z-index: 0;
}
#wrapper {
position: relative;
z-index: 1;
}
Further issues:
- doesn’t work in IE6
- no mouse pointer in Safari when hovering over links (even when added in CSS)
Recent Comments