Drupal: CCK/Views problem - drupal

The problem is the next: I have a recipe with images, and I have a video with node reference to the recipe (so I can hav a one to many). (see here)
When there is a video, it should not show an image, when there is no video, it should show the image.
I created a block for displaysuite, and attached the video to it.(see here), in 2 displays.
Now all i want is a theming function where all the image and video's are in so I can do some logic and format everything, but the video's and images are processed sepperately.
Can anyone help me out please ?

Not totally sure what I am missing, but assuming your view works and you have a display that shows all of the proper fields, it should just be a matter of creating an instance of views-view-fields.tpl.php for your particular view and/or display, and putting your logic there. If you click on the Theme link on the view, it will show the view template suggestions.

At the moment, I did it this way:
I get all the video's and images from a Node. Because the images and videos are different displays (video's is an attachement) they are rendered by different template functions. So in the functions a create an object in the $GLOBALS variables, that stores all the videos and images.
Then I create a template that renders the entire node, and I check the images and video's in the $GLOBALS with some if else's.
Looks like a dirty method (it probabely is) but it works

Related

no template defined wordpress masterstudy

I'm trying to do the layout of a course on masterstudy in wordpress, but I'd like to make a template for certain parts of the course, lets say for example when I hover over the title, show an image, when I click on a paragraph, make another one appear next to it etc... I think it is possible to have shortcuts for these and not have to copy paste the code each time I want to have these effects. I think this icon(see image) might do the trick (not sure) but I can't seem to save a template in my dashboard. So if it is indeed this button, can you please explain me how to save templates, and if it is not the solution can you explain me where to look ? The screenshot shows the Tiny MCE editor
Thanks screenshot

What is the purpose of Print device layout in Sitecore (or How do I use it properly)?

I have created a print button in my application that opens a new window that goes to print device layout by appending the current url with QueryString of Print device(?p=1 in my case) and onload it calls window.print() function. But this is useless because all the data user has entered will be lost when it opens a new window containing print device layout of the current page.
I can't think of a way by which I can use the print device layout and pre-populate the page with data user has entered. Can anyone help me with this?
Thanks in advance.
The point of the Print Device to be able to have a different set of Presentation components for display or print. Sometimes it is sufficient (and easier) to just use a print stylesheet, which hides/restyles certain elements: https://stackoverflow.com/a/12773239/19112
Obviously Devices works fine for non-form pages, or forms that have been posted and a confirmation page is shown (no input boxes, just text).
An alternative would be to use Rendering Parameters to set on each control, which could add a .print or .do-not-print class to then be used by the print stylesheet. You would then have to set the appropriate styles in the stylesheet to hide those elements. Note however that you cannot style the iframe content from the parent, you must link a separate stylesheet to the iframe src page if you want to style when printing.
You can append the user inputs to the print URL query string using javascript, for example:
var url = 'Current-Page-URL' + '?p=1' + '&input1=[INPUT1]'+ '&input2=[INPUT2]' etc..
Then in Page load event, you can set these inputs in the corresponding text/dropdown elements
Like mentioned above that device is a different set of presentation that can be used for many purpose. Early years when there weren’t responsive design, I used device to rendering different mobile device. You can use device to render rss feed or anything you want where you want to have different render set.
Another example if you have multi sites and want to rendering them differently you can use device as well.
Sitecore is very flexible that’s why I love it so much. There are always other ways to get same or similar results. From your context I don’t know what you are trying to achieve. If I want to have different set of presentation
here is some approach I will look into, Lavage rendering rules, tap into request pipeline, swap rendering controls in code, on item level specify style sheet…
If you can tell us what you are trying to achieve, I am sure someone will provide you their own solution. Then you will have more options to choose from and get the best fit to your project.
Hope this help.

What is the preferred approach for using dual images (fast-loading thumbnails and full-sized photos)?

As my posterous/twitter photo blog is reportedly going the way of the PC at the end of the month, I'm going to create my own. I don't want the page to take aeons to load, so I want to use small (in file size) images for the thumbnails but then, when a visitor clicks on it to view it full-size, show the "real" image (full-size, both from a screen dimension perspective and as to its file size), in a sort of reverse bait-and-switch.
So I reckon I'll need subfolders like:
Project
Images
Thumbnails
Fullsize
I imagine something like this is done a lot. Is there an accepted/"received" way to "minify" the images to use as thumbnails (some webby type tool), or will I have to save each photo at a smaller size, one by one?
My answer would seem to be the Lightbox jQuery plugin:
http://leandrovieira.com/projects/jquery/lightbox/
http://www.designyourway.net/blog/resources/30-efficient-jquery-lightbox-plugins/
Also, for automating the creation of thumbnails, see Irfanview's Thumbnail Viewer. See http://www.irfanview.com/ and http://dev.fyicenter.com/Interview-Questions/HTML/How_do_I_make_a_thumbnail_for_my_image_s_.html

Resizing the Tumblr Like button?

I am using a Tumblr like button provided by ThinkingStiff on like-button.tumblr.com and am having some problems.
I don't know if this is the right place to ask this question, but I couldn't contact ThinkingStiff through his like-button tumblr so this seemed like my best shot. First of all, I'd like to thank him for his codes on how to add a Like and Reblog button to any theme. I am using them on my blog over at shelteryou.tumblr.com and they are working wonderfully. However, as you can probably tell, the like button is a bit too big for my theme. I was wondering if there was a way to shrink it down to a more suitable size? Thank you in advance!
They use a background-image, so if you want to have a different size, you'd have to change the image resolution (or create a new image) in your favorite image editor. Then upload it to Tumblr (they provide a upload service for theme files only) or make a data URI out of it.
Then change the URL in background-image: url(…) to the new one (the first for the grey image, the second for the red one).
If you need the current images (so you can save them), copy/paste the two data URIs (everything inside the brackets) to your browser address bar.

node with multiple images attached (drupal 6.x)

I'm creating a site where user can create a node with multiple images attached. For that matter, I have installed image attach module. I also have view and view slideshow module installed so that user can see the uploaded images attached to this particular node in slideshow style.
The problem I'm facing right now is that view does not show all the images attached to this particular node. It shows one image only and that's it.
The way I set up the view is - I create it as a block, select "image attach" for Fields and choose node id for argument. Under the node id, I choose "node id from url" for default argument. The result is just only one image being shown.
I've been trying to figure out what I'm missing and, so far I found out that image_attach
table stores images attached to the same node with same nid. And the view query is returning only one. I appreciate much if anyone of you can point me to right direction.
Thanks in advance
Your approach seems okay except one major thing -- the use of Image Attach ! Consider using Imagefield ( http://drupal.org/project/imagefield ) with Imagecache modules ( http://drupal.org/project/imagecache ). They work really well with Views and Views Slideshow in particular. Imagefield+Imagecache is really the standard way images are now done in Drupal. Its also the default approach for images in Drupal 7.
There is plenty of documentation available about this approach.

Resources