In Drupal 7 views how to give external link (another website) to a title? - drupal-7

Iam new to drupal 7 views.
I have a content type contains title, description fields. I want the content title's to scroll at the top of the page, so that i created a view and it works fine.What is my question is, i want to link a content (eg: 1st content (title) in a scroll) to another website instead of content page, the remaining contents linked to the content page. Is it possible?.If it is possible how it can be done?..
Thanks in advance,
A.John Melchior.

Yes, it's possible.
One way to do it, would be to use the Link module to create a link field in your node.
Use the link field to input the external link value.
In views add the link field, before the title ( order is important ) and exclude it from display
Add the node title field in the views and in the rewrite field output option, use one the link field token as your path.
I'm not looking at the Views UI right now , but you should find at least a couple of ways to redirect content when the node title is clicked. You should have the Rewrite field output and the Output this field as a link.

You could make use of Display Suite coupled with the description above.
Create a link field for your nodes.
Create 2 view modes for your content type via Display Suite. View Mode 1 will show the link field as the first data element, View Mode 2 will show the title as the first element.
Configure your view to show output using Display Suite, configured to show the first record using View Mode 1, all others using View Mode 2.

Related

Drupal 7 basic page with a dynamic block with arguments

Can anyone guide me to a route to take as far as making a basic page in drupal 7 and then having that page load a block with images inside based on URL path.
So I have a content type that is for 1 type of pages and another content type for another type of page. Each content type has 30 pages. I don't want to create 30 pages for 1 page that will have the same content over and over but with a different logo.
http://www.example.com/contenttype1name/%/staticname
I need to make the menu have an argument passed and then based on what is passed go get the correct image.
Sorry if this is confusing. Thanks for your help.
You should look into the views module - it allows you to easily create a view with dynamic parameters (contextual filters) that allow you to easily tackle things like this.
I used contextual filters on views and nodesymlinks along with panels that was already installed.
Modules Used:
Views
Nodesymlinks
Panels
Step 1: admin > Modules > Add Modules/Enable.
Enable Nodesymlinks
Enable Panels and panelizer
Step 2: admin > Structure > Views > Add View.
Make view, name it and check block not page (I used Fields).
Step 3: admin > Structure > Views > your view.
Add filtered Criteria - Content type = your type.
Content should be Published only.
Add contextual filter: title.
Configure contextual filter: Content: Title.
Provide default value. Select Raw Value from URL.
Path component select 2. You can add it where you want in the URL.
Use path alias and check it.
Under More you need to check this box: Transform spaces to dashes in URL.
Check it in Views and save.
Step 4: admin > Content > Add Page.
Add a basic page.
On the bottom of the page you will see: Provide a menu link. You want to check that box. Now you will be able to add all the menu links that you wish this page to show up on. Add links/Paths and titles. Make sure you use argument 2 in your link to be your content on the views block in step 3.
Step 5: admin > config > content > panelizer.
You want to go into this pages panelizer, could be basic or whatever your content type would be. Add your views block and save.
Step 6:
Test it. If it doesn't work then you need to check your titles in argument 2 in the URL. Worked for me. Saved me a ton of time.

Addressing the tab menu in view when using taxonomy

I use taxonomy terms to address my menus(these taxonomy terms show the structure of my site) so when I create a view I should use the taxonomy path (instead of alias) for the page setting (the only way that I can link the view to my taxonomy address path as far as I know :P ). whenever I see the page URL I can see the alias. now I'm trying to set up a page that has 2 tabs. I have set it up but the problem is when I click in the tab I see the taxonomy path instead of alias ? (for example taxonomy/term/6/digital instead of CCTV/digital However default menu tab still work correctly and show the alias CCTV)
Is there any way to show the alias instead of taxonomy term address ?
I assume that you have a view that is filtering your taxonomy terms. If you render the results as fields, each field can have it's formatter. If you need a custom form of the output, you can define your own formatter or generate one via GUI with help of: custom formatters.
In case that you render your output as rendered entity, you need to find the right template file and use the drupal_get_path_alias() function within it.
As last I would hint you a great module that also might help you: taxonomy menu

How can i create a DRUPAL view mixed with nodes and files?

as the title says I'm trying to create a view that displays rendered files and nodes together. Normally when you create a view you have to select what type of content (nodes, taxonomy, files ...) you want do display.
What i want to achieve is a view that displays all nodes and files. The files are NOT mandatory associated with a node. But they are also tagged with terms.
Any idea how to solve that?
Thanks in advance,
Fab
Why don't you create 2 block views and then display it in a page?
For example:
Create a view block that displays the files --> "display_files-block"
Create a view block that displays the nodes--> "display_nodes-block"
and then print them in a static page u create,
For example: "Display files and nodes", with id 1.
inside page--node--1.tpl.php write:
$block = module_invoke('views', 'block_view', 'display_files-block');
print render($block['content']);
$block = module_invoke('views', 'block_view', 'display_nodes-block');
print render($block['content']);
This doesn't answer the question correctly but can be used as a work around for getting data from two entities to appear in one view.
Through the UI, you could create a view called FilesAndNodes, and only add Global:Custom Text Area under the fields section.
Then create another view called Files, and add this view under the Header section of FilesAndNodes view.
And then do the same for nodes.
The Block created by the FilesAndNodes view can then be added to the page, and the content appears as one view.

Drupal 7 - How to create a contextual filter based on an aliased url

CASE:
I've created a content type 'Attorney', and have set a url alias pattern for all attorneys to be 'attorneys/[node:title]'. I'd like to create a view that uses the aliased path to display the information about the attorney. This view should have a 'page' display.
EXAMPLE:
When a user visits 'http://mydomain.com/attorneys/aaron-silber' the view returns data for the Attorney with the name Aaron Silber.
BACKGROUND:
I've searched high and low for a solution to this but can't seem to find one that works for me. Typically I'm asked to create a page view with a url of 'attorneys/%' and add a contextual filter with 'Content: Nid', choosing to provide a default value (type: Raw value from URL, path component 2).
The resources on the web for this case are aweful at best. Lets try to fix it here once and for all.
Thanks!
Use a Views block instead with the visibility set to "Only the listed pages" and supply "attorneys/*" in the textarea. Set the block to display in the main content region. Use the Content: Nid filter with a default value of path component 2, as you were previously attempting.
You can't have an attorney node page and a Views page occupying the same URL.

Views Content Pane "Related content" by taxonomy

I'm currently developing a Drupal 7 site where I use Page Manager's "node_view" to customize the layout for my "Article" content type.
So, whenever viewing an Article I want to show a little box with "Related content".
I have a taxonomy vocabulary "Shared category" that I use in all my content types.
For example I also have a "Gallery" content type, so when viewing an article in with the "myTag" term - I want to show a Content Pane with images tagged with "myTag" from the "Shared category" vocabulary.
My question is about setting up the Contextual Filter for the Content Pane.
Should the "Argument input" be a Vocabulary or a Term? - I've tried both but can't get it to work.
Also I have another question: Is it possible to use a Content Pane as a block, that is shown with the Panel? - I guess not, sinse the Contextual filter value comes from Page Manager.
You won't want to manually input the argument in the panel, as it will vary for each article.
You'll want to set it automatically using a default argument that gets the tid from the node.
To get the related content block to show content based on the same terms as the node being viewed, you'd need to add a taxonomy term id argument to the view.
You can then try the 'Set a default argument' and use 'taxonomy term from URL' ( node option )
If that doesn't work, you may need to get the relevant tid from node using php code in the default argument area, with something like node_load or menu_get_object to load the node.
e.g something like
if($node = menu_get_object()){
if(isset($node->field_shared_category[$node->language][0]['tid'])){
return $node->field_shared_category[$node->language][0]['tid'];
}
}
Related content can be shown by using contextual filter in block views. This block view will contain content which are associated with the current content viewed by a user.
You can goto "Create related content block view based on terms in Drupal 7" blog post to get step by step instruction to create this block view.

Resources