Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Website settings: new tags for website setting fields?

Website settings: new tags for website setting fields?

Jens Jakob Vedel Kristensen
Jens Jakob Vedel Kristensen
Reply

Hi,

I am trying to figure out how to retrieve data from website settings fields on DW9.

This razor tag works fine on DW8:

@ GetString("Item.Area.FIELDNAME")

DW Support informed me that some changes were made in relation to some tags, and a compatibility pack with a tag translation feature is on its way. But we need to make it work now.

I was given this link: http://doc.dynamicweb.com/template-tags/content/content/websites

I looked around and I was hoping this page to help me: http://doc.dynamicweb.com/template-tags/content/content/websites but no luck...

Does anyone know how to retrieve data from Website settings fields on DW9?

Thank you in advance


Replies

 
Nicolai Pedersen
Reply

Hi Jens Jakob

These tags are stille the exact same, so it should work. You have a space between @ and GetString, i think that is because you write here. If not, that could be the error.

Can you provide us with a link?

 
Jens Jakob Vedel Kristensen
Jens Jakob Vedel Kristensen
Reply

Thank you for the fast response.

I put the whitespace between the characters, just as a precausion so I was sure the tag wouldn't cause any trouble on this forum post page (just descovered the code block now).

So the website settings field tags are the same in DW9, that´s good to know. Hopefully we won't have to go through a lot of templates then.

The website has not gone public yet, so I cannot provide a link to it at this time.

We have a website field (integer number) containing the ID for the page containing the footer content. In the master template we reference this field to get the content for the footer:

@if (GetValue("Item.Area.Footer_Content_Page_ID") != "")
{
	@RenderPageContent(GetInteger("Item.Area.Footer_Content_Page_ID"))
}

The footer content page ID is set in the website settings field, but it seems like it loads the entire website over again inside the footer. 

Weird...

 
Nicolai Pedersen
Reply

It could be either a circular loop or because of changes in the pageview life cycle.

We will have to test this locally and see what we come up with.

That said, I really think you should reconsider this approach for footer rendering. Rendering all the content from another page in the footer sounds like bad performance and way too much content/markup in a footer no one reads. Could be replaced with item based fields on the area item instead. My 2 cents...

 

 
Jens Jakob Vedel Kristensen
Jens Jakob Vedel Kristensen
Reply

Ok, thanks.

The reason for this approach is to give the editor easy access to modifying the footer content/settings in the content context. As well as having the possibility of applying item paragraphs / modules as needed. All without the editor having to edit the website settings, where they shouldn't go, if avoidable.

However, if rendering the content of a page by ID-reference in master template is problematic due to performance, perhaps another way is possible.

What if we render specific paragraphs in the footer by referencing the specific paragraph IDs in the master template? This way we do not render "everything on this specific page", but just the specific paragraphs by ID-reference.

 
Nicolai Pedersen
Reply

It would be the same thing that happens. Calling RenderPageContent is the same as RenderParagraph x times. RenderPageContent only renders the paragraphs anyways.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Jens Jakob,

I'm trying to understand what the problem is here. Where do you see the difference in behaviour between DW8 and DW9?

Are you getting an unexpected output from GetInteger("Item.Area.Footer_Content_Page_ID") ?
It should give you the integer value that you have entered on the area item (website settings).

Are you getting an unexpected output from RenderPageContent(ID) ?
It should give you the combined output from all paragraphs found on the page with that ID.

BR, Morten - Dynamicweb

 
Jens Jakob Vedel Kristensen
Jens Jakob Vedel Kristensen
Reply

Hi Morten

@GetInteger("Item.Area.Footer_Content_Page_ID") returns the value: 7, which is the page ID.

@RenderPageContent(7) returns, as it seems, the entire page incl. the top of the website. Not just the paragraphs (content) on the website. 

The specific code we use without issues in DW8 is:

@if (GetValue("Item.Area.Footer_Content_Page_ID") != "")
{
@RenderPageContent(GetInteger("Item.Area.Footer_Content_Page_ID"))
}

I tried created a new website integer field, and the difference was that it returned nothing. Not the entire page incl. the header.

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
Hi Jens Jakob,

I'm not able to reproduce the issue that you are experiencing. @RenderPageContent(7) only renders the combined output from paragraphs on the page with ID = 7

The issue might be caused by some invalid HTML that confuses the template parser. Have you tried using a very simple template that only renders the footer?
Please try the attached layout template and see if that works.
 
If you cannot locate the cause of this error then you can submit a new case on Engage and we will investigate it further. Please provide FTP access (or similar) so that we can obtain a copy of the entire solution (application, files, database).

Morten
 
Jens Jakob Vedel Kristensen
Jens Jakob Vedel Kristensen
Reply

Thank you for the suggestion and template.

The result was the same.

I have created a case on engage, since it might seem like this is a local issue on this DW Standard solution, rather than a general issue.

 

You must be logged in to post in the forum