Alias/Redirect Page Type in Composite C1 - c1-cms

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.

Related

EpiServer: Reference RootPage Without A Page Context

I am working on an EpiServer project and the team we are working on it with updated the code in the repository, but has not sent us an updated version of the database. As a result I am not able to load any pages, when I try to do so I get 'TypeMismatchException'. I have tried converting the page types via 'Admin -> Content Type -> Convert Page' but this does not work. Doing 'Root -> New Page' also only gives me the option to use corrupt page types.
What I'd like to do is to create a page programmatically as a child of root but when I call
PageReference parent = PageReference.RootPage;
It tells me the 'ProviderName = null' because I have no page context.
So instead of determining the root page based on the page I'm currently on, I'd like to do the opposite, I'd like to reference the site I'm currently on, and given the site I should be able to reference the root page of that site.
Does anyone know if this is possible?

Drupal 7 Views related query

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

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.

Resources