Add a Flash video - drupal

I have been trying to figure this out for days. Hope someone can help.
I am implementing a new theme for a site. I added the html to a page.tpl.php file, populated it with the appropriate variables, and it works OK so far.
It consists of a header, footer, and a left and right div. The left div successfully displays the output of the $content variable.
The right div is supposed to show a flash video followed by two images, all displayed vertically, which vary with each page. And here I'm really stuck.
How do I go about adding these?

Depending on how much you want to program you're probably going to use blocks. I you don't want to program a lot create a bunch of blocks with each image/video combo you want. If you don't mind programming you can create a block in a module with all the code necessary to pull up the right images/videos on the right page.
But the most basic way will be at /admin/build/block/add then associate the block with the right area on /admin/build/block. You can control which pages these blocks wind up on on the block edit form.
This link may be handy for you.

The first thing you need to do is add the files to each page. You can do that with CCK and filefield.
Once you have the files in the pages, you need to get them out of $content, where they'll show up by default. You can do this by turning the fields off under Display Fields in CCK.
Now that the files are no longer in $content, you need to put it in something else. Most themes have a $right region you can use for that. So put $right in your right div. You can populate $sidebar with blocks, so you need a block containing the files for the given page.
You can make this with Views. Create a new node view, add an argument for node ID, and give it a default value from the URL. This basically tells the view to look at the current node/page. Under Fields, choose "Content" and find the file fields you added with CCK. Finally, add a display of type "Block." Save.
Now you have a block with the files on the current page, and you have the $right region on every page, so just go to the Blocks admin page and put this block in that region.

Scott and Chuck have already provided the details for this question, but I thought I would just point out scenarios when each answer may be appropriate.
If you want those video and photo blocks to display on pages which are NOT node pages, then you will probably need to go with a solution similar to the answer Chuck provided.
Most likely, it sounds like you do want the the video and photos to be related to the content shown on the left. If that is the case, then Scott told you what you need to know.

One final piece to the advice from those above was the following:
"How (where) do I set it up so that the view recognizes that it is on Node 3 and displays only the images for Node 3." -- you can do this by clicking on the settings for the Nid argument in Views. Under Action to take if argument is not present: choose Provide Default Argument. In that, choose Node ID from URL
Position your block in the appropriate region (left sidebar, right sidebar etc). Make sure the visibility settings of the block are such that it only appears at paths that match node/*
Thanks, all!

Related

Drupal + Views Slideshowplugin?

I have a question, but the problem is, I can't show the page right now, because it's only on my local server. I will try to explain it as good as possible.
I've got a view that makes my frontpage have the full content of my nodes. So you see a node(in this case an embeded youtube link). You can then go to the next node via "next" or to the previous one via "previous", etc. The problem I have and I don't know how to fix is:
I got a gallery below(another view), of all my nodes, so you can either click through the prev and next buttons, or click on one of the pictures in the "gallery". But when i click on the galery, it goes to the node links so lets say "site.com/node/44".
Is there a way I can go to the node/44 page and still be able to click prev and next? And moreover, can I use the Slideshow plugin by views with changing links? Because it's just says "#" in the url... Like it does with the main content when i click "prev" and "next"?
I hope you can understand what this is about :-). If not, please feel free to ask for further information.
So your explanation is a little "garbly" so here's my somewhat 'not-so-garbly' response:
Sounds like your understanding of views is a little low. Make sure you're Displaying fields in your view and not just full nodes or teasers.
Next, if your desire is to show the gallery on all the nodes of the same type, you can so by creating a block display in views and configuring that block to show up ONLY on the node type you desire.
It gets complicated when you (which appears to be your desire) want the view to start from the last point you were viewing. This will require rewriting the field (this is available via the field configure form) which contains the image. You'll have to add a parameter (probably the current nid) which can be added, hidden, then accessed as a token via the Views Fields interface as well.
I don't remember exactly how to get the view to display the current (or next) slide by default once it's clicked.. but this is probably how I'd do it:
pick up that parameter in JS / JQ and use it to find the slide you want to display... then fire the JS function needed to display the desired slide.

Drupal 7: navigation menu with Views?

I want to make a long page consisting of multiple nodes (each of the same Content Type). The page should have navigation on top of it that will allow to jump directly to the desired point of the long page, kind of like here: http://www.apple.com/macbookpro/features.html (there navigation is under the picture)
I used the Views module to assemble a long page from content, and for navigation I tried to use another View of the same content, only inserted in the top of the page as a block. I set this view to display grid of fields; it looks good. Only I could not figure out how to make each cell in the grid to become a link to the content on the same page.
I tried modifying views template, but there $rows variable turned out to be a string with already assembled html. Maybe I could possibly modify the content template, and insert some sort of condition that will change the way content looks based on what part of the page current view is located, but I am not sure how to do that either.
In the views, edit the field selected, and there are options there to configure the field as hyperlinks how you may want them. Also you can just let the field link directly to the node, there is an option for that. cheers

How to embed a node on homepage in Drupal 6?

How can I embed a node on the front page in Drupal 6. The node basically has the image upload field along with title and description. I want it to some how appear on the homepage alongwith a "views" which shows the uploaded images at the bottom.
What I want is to give the users an ability to create content which is right now available at .../node/photo/add. I want to somehow show this box which lets one create content i.e. upload photo with title and description on the homepage.
It's basically just an attempt at creating something like imageshack as an experiment.
I am pretty n00b when it comes to drupal so please be more descriptive.
Jukebox's solution works as a point-and-click method. If you want to do it with code, it's more like this:
create a glue module Handbook | Example Blog Post
turn it on in admin/build/modules
create a menu item using hook_menu() that will become the page
embed the node with node_view()
embed the view (blog post)
in admin/settings/site-information set your page to the
You can use the Node Blocks module to, well, turn your node into a block. This means that you can go to the /admin/build/block page and place your node in a particular region.
After installing the module, edit the Content Type of the node you want to turn into a block. Under Workflow Settings, Available As Block, choose Enable.
Now you can go to /admin/build/block and you can see some new blocks. Just choose the one you want and place it in the region of your choice. You can also configure that block's visibility settings from there as well.
If your planning on having a more complicated home page at any point in the future I'd highly recommend using Panels to do this. It will allow you to arrange your front page with views and nodes in a grid method.

Drupal: Content in blocks from node_reference fields?

After only a few weeks of working with Drupal I've come up with a recurring problem, which I don't really have an optimal solution to, so I'm hoping that someone here might be able to give some best practice pointers.
What I have is a region inside my node.tpl.php, which is populated with blocks that display content from two different CCK fields of the type node_reference. This works fine when displaying a single node. The problem appears when I need to use a view.
For example, lets say I have a news listing, and a single news item view. When I display the single news item I can use the news node node_reference field to reference whatever material I would like to have in my sidebar, but when on the news listing view I would like to reference nodes separately. What would be the best practice to solve this?
I'm having a few ideas, but none seem like the logical choice, how would you do?
My understanding of your problem is that you don't want the blocks to display on the view page and you want the block information displayed inline with the node.
The first part is easy, you can modify the block visibility settings to not show up on the path where you have the view.
The second part will depend on how you set up your view. If you are using fields you can simply add fields for the node_reference and they should display. If you are using a node view, you will have to override the template and create a template which displays the node reference field.
If you want further explanation please comment and I can clarify
After reading my question I realize that it was explained pretty badly, so I'll try again, and also tell how I solved it.
The Problem
On normal "pages" (when displaying only a single node), I have a sidebar that shows something similar to banners, which are either random, or I can select one or many that should always be displayed on the sidebar. This is solved easily when displaying a single node, using a CCK node_reference field. The problem is when using a View that displays multiple nodes, for example a news listing-
The Solution
In my case I could solve this by creating additional fields on my default Page content-type. These fields were called view, display and arguments. In my tpl.php I then embedded the news listing view inside a page, lets call it News. This way I gained great flexibility, and also helps the News page to know where it is located in menu structure.
Final comments
I have yet to discover if there are any drawbacks or dangers in doing this way, but if there are, feel free to share them with me :)
I tend to want to create my own modules, which create blocks and reference the database directly. Then I put the blocks inside of panels, this seems to be more flexible for me than using views and cck fields etc ...

Problem attaching Ubercart view to relevant content

Example page: http://giantcalculator.com/content/cartridge-filters
It’s very cumbersome to connect the ubercart view to a relevant content page. In the example above I have attached the view to the bottom; you can scroll down to see it. It is a tedius process though in which I have to create the view, then create a mini panel, include the view in the mini panel, then go to blocks page and add the mini panel to region (currently a region below the main content), then I have to configure the block so the view only appears on it’s one particular page.
This seems far too complicated and the particular region will soon have about 20 blocks inside it, though each only appearing on one page. Is there a better way to attach a view to its relevant content info, or vice versa?
I know the view creates a page of its own, and if I could add the content on top of the view that would be great. Or within the view itself, can the content be added somehow?
I'm almost ready to move forward with this site but I really need to find if there is a better method first. I'm posting this in a number of places and offering a $20 bounty via paypal to the first responder with best alternative that I end up using. (if there is one). Bounty may be shared if two or more people have the same response on different forums and I can't tell who was first, though when I do have an answer I'll promptly post it.
Other forums this will post include Drupal.org paid forum, Ubercart Bounty forum, aardvark, superuser and stackoverflow.
If I understand correctly, I think the piece of the puzzle you're missing is Views arguments. If you ever find yourself creating more than one view, where the only difference is the content (ie. based on taxonomy, or a certain CCK field), you probably want to use that as an argument in the view so it loads the correct content automatically.
I assume "cartridge filters" is a taxonomy term, and the page linked above is a node with this term applied. So you'd add a taxonomy arg to your view in the Views admin, and get it to pull the term from the current node. There are a bunch of tutorials out there on this, and here's a screencast: http://gotdrupal.com/videos/drupal-views-arguments
I'm also not sure why you're using mini panels. They're generally used for sets of blocks or other content to be displayed repeatedly, like a tabbed block or footer. It sounds like you just want a regular block display of the aforementioned view. You could also make this entire page a Panel.

Resources