Views and Categories...? - drupal

it's about this page: http://veagues.com/
Hey guys,
I've made a block-view with drupal that let's me sort my videos by a certain category, in this case "funny","epic","plays", "contest"...
The problem is: When you sort it by the certain category and click on a video and continue to click the "next" button, you will go threw all videos, instead of only the videos of the category...
My Question is: How can I put a filter on the nodes when i apply another category on the bottom block?
Thanks already!

If you're using Views, you should be able to filter the main block by the same taxonomy term.
Try adding a Contextual Filter to that block too. If there's a taxonomy term ID in the URL the block gets filtered by that Term ID and if there's no result, the block shows all the videos.
EDIT -----------------------------------------------------------------------------------------
You may need to try & understand what goes on when you make a selection in Drupal.
1/ The taxonomy term page will list all the content affixed with a specific term. The term tid can be seen in the URL, unless an alias have been created. A block can retrieve that term id, whether there is an alias or not.
2/ The node page will give you access to a specific node, but any block on that page should be able to access the term id of that specific node.
If you know where you are, it becomes easier to retrieve the info you're looking for. On the other hand, you may have to reconfigure a specific page in order to add the necessary extra block...
That can be done with templates but you could also have a look at Panels.
The Panels UI makes it easier to configure the page you're looking for without having to mess with code or templates, or both.
There's a lot of free video tutorials out there, search for Views & Panels.
If you want to have a look at preprocess functions, you will definitely need to download the Devel module...
...but have a look at these sites first:
http://codekarate.com/
http://drupalize.me/
http://buildamodule.com

Related

Drupal Views & URL Alias Override Issue

I have a taxonomy vocabulary called 'catalogue'. Within this, I have levels of terms. Some have sub-terms, some have nodes.
I have two views to handle these: One to show sub categories, one to show nodes, each with a filter applied based on the URL. If I go to sub-category/category-name, it would show me all the sub-terms in category name. If I go to product-category/category-name, I get a list of related nodes.
With no aliases, the view works properly on sub-category/%. The problem with this is that the generated links for the sub-terms aren't to the view, they're to the term page.
If I create aliases, it overrides the view and shows no results on sub-category/% pages and default node teasers on product-category/%.
Can I use aliases with views in this way?
Sounds like you want to re-write the output of the Field instead of creating aliases. If you're not familiar with that particular feature in Views, see the screenshot below from http://highrockmedia.com/blog/rewriting-drupal-views-output-custom-theming-css
Note that instead of creating a <div> wrapper, you can create your own link as needed. Hopefully this will help you get started in the right direction.

Concrete5 Custom Content Types (Blocks)

Is there anywhere online where one can find how to create custom blocks in the same way we can create custom content types in Wordpress. The desired result is to add a block that will allow the user to add/edit custom fields like client name, portfolio description, portfolio thumbnail.
I've created a free tool called "Designer Content" that lets you easily generate these custom blocks:
http://www.concrete5.org/marketplace/addons/designer-content
That being said, it is important to understand this key concept: In Concrete5, everything revolves around PAGES. In general, you want to try to establish an architecture where each piece of data is represented on its own page (a "details" page, which would roughly equate to a single blog post in Wordpress). Then you use the Page List block (usually creating a custom template for it to modify its look) to list out titles, links, and excerpts/photos from each of those "details" pages on a top-level "index" page (roughly equivalant to the home page or category archive in Wordpress).
For example, if you're building a portfolio site, you might want one top-level "Portfolio" page that shows a thumbnail and title of each piece, then a "Portfolio Item Detail" page type that contains one piece per page -- each living underneath the top-level "portfolio" index page.
The benefits of this approach are C5 gives you out-of-the-box tools to manage your "data" (pages) in this way -- users can add, edit, delete, and rearrange the pages via the "Sitemap" in the dashboard. Site search works without any modification -- each page (i.e. portfolio piece) will be its own search result with a link to a specific page. Also you then have more fine-grained control over access permissions if you ever decide to restrict access to only certain groups of people (registered users, etc.).
If you take this approach, you might find the "Page List Teasers" addon helpful (it will let the Page List block -- which you're using for your top-level "index" page -- to show actual content excepts from the pages instead of just a separate "description" field):
http://www.concrete5.org/marketplace/addons/page-list-teasers
Or if you want to dive deeper and customize the page list template even more, I have a starting template with a ton of code comments in it explaining how to do different things here:
https://github.com/jordanlev/c5_clean_block_templates/blob/master/page_list/view.php
But... if you're only talking about small amounts of information and you think a separate page for each one is overkill, then the Designer Content approach I linked to first will work just fine.
You can find a HOW-TO on creating new blocks written by Franz Maruna on the concrete5 website.
Here is the link: Creating a New Block Type
There is also a simple block you can download and install to help you follow the developer tutorials. You can find that here: Simple block template

Different pages for showing different fields of a single node in Drupal 7

Is it possible to elegantly do this? The idea is, a node of content type "project" has a lot of fields, its url is something like node/5. I want to show some of the fields on that page, and others on node/5/extra, kind of an "extended" page that the user only loads if he is interested in that content (lots of images, in my case, that would slow down the main node page considerably).
I tried the Display suite module, unsuccessfully (it seems it's not really meant for doing what I want). I also saw this blog post, which explains how to add a custom display mode to a content type (other than the Default and Teaser ones that come by default), but I can't get it to work the way I want to either.
I guess you could create a view having the node ID as a default argument from URL. Then you can choose which fields to show or hide

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