page Template not rendering content pulled form another page type

Kurt Muller asked on March 6, 2018 10:01

I have a page template that I created using the HTML layout type and I am trying to pull in data from a content only page type that I've set up, but the page is returning empty. On that same template I have a localization term pulling in successfully.

With regards to the macro, if I add that to a plain editable text area it works.

Anything thoughts on why this is happening

Kurt

Correct Answer

David te Kloese answered on March 12, 2018 15:52

it should display the version number... as in 10.0.41.

This is based on two things

file:

WEBSITE FILE ROOT \CMS\App_Data\Install\Hotfix.txt

Database:

select KeyName, KeyValue from CMS_SettingsKey where KeyName in
('CMSHotfixVersion', 'CMSDataVersion', 'CMSDBVersion')

results:

CMSDataVersion  10.0
CMSDBVersion    10.0
CMSHotfixVersion    51

If this somehow mismatches you might have an other issue. The value displayed in the admin shows the DB value of CMSHotfixVersion.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Dawid Jachnik answered on March 6, 2018 10:49

Based on content only pages you can't use them with page templates. They are suitable for MVC websites for hold only content.

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 6, 2018 11:07

Thanks David, but I've had this working successfully on another project of mine so I know it's possible.

I've just discovered something else as now as well: The content is visible only when I am in a Kentico logged in state. The moment I try to test the content in another browser or in incognito, the content does not render.

Very strange behavior.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 6, 2018 11:23

You can view display content only items. But the template can't be set on that element itself.

Since it works when logged on it must be a permission thing.

Can you check the security tab of the content only 'pages' you want to display? Or perhaps the folder above it has "Requires authentication:" set to YES.

What are you using to display the items? A repeater?

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 6, 2018 11:38 (last edited on March 24, 2018 12:16)

Hi David

My structure is as follows: I have a page (pagetype = folder)called sharedContent and nested inside is a custom built Content Only page called offerContent. I've got some basic text fields which I have populated with content.

Both of the above pages have Requires Authentication set to Inherits (No)

Then on my master template, I am trying to populate an editable text area with the following macro: {% Documents["/sharedContent/offerContent"].header %}

This has worked before, but i get nothing now. I've tried other Web Parts as well and nothing is working.

I'll continue checking permissions issues

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 6, 2018 15:23 (last edited on March 24, 2018 12:16)

Not sure if this is a correct way to display content. Why did you use a macro with hard coded path?


regarding the issue itself:

this macro {% Documents["/sharedContent/offerContent"].header %} in your editable text.

Where did you enter it? On the page tab or as a default value from the editable text web part?

You could also enable security and/or macro debugging on live site (if its not production). This way you can see if the macro returns any date (or an error) and if there might be any permission issues.

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on March 6, 2018 16:19

Hi Kurt,

If I remember correctly there was an issue with 'Documents' macro in kentico 10 version. Could be that cause your problem. What is latest hotfix that you applied on your installation (you can check that by clicking on question mark in header of admin portal)? If you are using version bellow 10.0.4, please upgrade it to at least that version.

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 8, 2018 08:24

Hi David

Thank you for that very valuable link to debug macros. I'm fairly new to Kentico and still finding my feet regarding the optimal way to build these sites.

@Dragljub, I will have a look at that issue.

Kurt

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 12, 2018 12:26

Hi David Looks like it's permissions issues, but I'm not sure what. Requires authentication is set to No on both the page as well as it's parent folder.

If I'm in Design mode I can see the expression resolve and it's successful when I run it through the Macros console.

Could you think of other places where I might need to change the permissions?

Kurt

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on March 12, 2018 13:14

When you enable debugging what error do you see on that macro?

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 12, 2018 15:38

There's no errors, it just returns a null value.

Something that I have now picked up is the following: In Kentico Installation Manager, the hotfix applied to this projects is stated to be Hotfix 41, but when I log into the admin section of the site, and click on the info button (?, top right of the page), it still states that the site is built on 10.0.0.

Is there a difference between version number and hotfix applied?

0 votesVote for this answer Mark as a Correct answer

Kurt Muller answered on March 15, 2018 13:41

@David, you're the winner!! There were issues with mismatched hotfix versions.

Thank you very much :)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.