Drupal 7 Views related query - drupal-7

I have a Page and a Block both are created using Views.
I want to display this Block along with the Page i.e. on Left hand side, Page's content will be shown and on the Right hand side this block's content but at the same time I don't want to configure this block from the administrative settings. How can I achieve this ?

You can create 'page' template file for your view and use module_invoke() function to call your block into it.
Page template can use following pattern -
page--[path].html.twig
module_invoke() documentation -
https://api.drupal.org/api/drupal/includes%21module.inc/function/module_invoke/7

Related

Alias/Redirect Page Type in Composite C1

I have the following structure:
Area
- Page 1
- Page 2
- Page 3
Navigating to Area should be equivalent to navigating to Page 1.
I don't want to solve it using Routes, because I want an editor to be able to set up a similar structure and edit "Area" to point to "Page 1".
How can I create a Page Type where I can set a target page as a setting, and make the page result in a redirect instead of page content?
You would insert the function named Composite.Web.Response.Redirect into the page content of Area.
You would need to switch to Source Mode of the page to be able to insert it, since the function doesn't return anything and the function-selector in Visual Mode only shows functions that returns actual content.

Get nid of a view in Drupal 7

I created a view that makes a block for my homepage. I need to render this block in my PHP. Problem is, I need the nid to render the node and I usually get these by going to Structure -> Blocks -> Click configure and the ID is in the page url at that point. For this view I created, there is no ID, just /admin/structure/block/manage/views/cfps-block/configure.
How can I get the ID so I can render this programmatically?
If i understand your problem correctly.
Open you view
For example:
Blockquote
example.com/admin/structure/views/view/custom_view/edit
get the Machine Name of that view suppose it is block, than you can render it by using following code.
echo views_embed_view('custom_view', 'block');
Read the manual if any confusion:
https://api.drupal.org/api/views/views.module/function/views_embed_view/7

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.

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

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.

How to move content to drupal 7 region?

I have created a region named "footer" in my drupal 7 template.
I have created a content type named "footer-article".
I have created a block called "footer-block".
What I want to do is:
whenever I create an article of "footer-article" content type
I want it to automatically reside in the "footer" region in all of my pages/ or some of the pages?
What is the most efficient and simplest way to do it?
because I was thinking that I always need to create new blocks and put article inside this block in order for me to position it in my desired region?
I am a newbie in drupal 7
Thanks for your help.
Install the views module. Always install the views module.
http://drupal.org/project/views
It will allow you to make a list of a content type, which you can then export as a block and add to your region. This will automatically update the block when ever you add a new "footer-article".
You can set the view to show full posts, teasers or certain fields.
It's the best module for Drupal in my opinion and is a must have for any Drupal sites.

Resources