ncbruckner
Returning Observer

Diiference between preview and deployed code

Jump to solution

Hi,

I implemented a new feature, where I add a section template to a page and in another page, I show a list of all the pages that have that section template.

<table class="M-Table__contentWrapper">
	<tbody class="M-Table__content">
		<tr class="M-Table__row M-Table__headlineRow">
			<th class="M-Table__cell M-Table__cell--head">
					$CMS_VALUE(st_headline)$ Showcases
			</th>
			<th class="M-Table__cell M-Table__cell--head">
					Usage and description
			</th>
		</tr>
		$CMS_FOR(for_page_folder, st_folder.get.getChildren(class("de.espirit.firstspirit.access.store.sitestore.PageRefFolder")).toList())$
		$CMS_SET(is_in_overview_page)$$CMS_RENDER(template:"ft_fs_util", ft_option:"section_template_used_in_page_body", ft_template_uid:"st_m_additional_data", ft_page:for_page_folder.startNode.page)$$CMS_END_SET$
		$CMS_IF(is_in_overview_page.toString.trim.equals("true"))$
			$CMS_FOR(for_element, for_page_folder.startNode.page.getBodyByName("main_overview").getChildren(class("de.espirit.firstspirit.access.store.pagestore.Section")).toList())$
				$CMS_IF(for_element.template.uid.equals("st_m_additional_data"))$
				<tr class="M-Table__row">
					
				<td class="M-Table__cell">
					<span class="M-Table__mobileHead">
						$CMS_VALUE(st_headline)$ Showcases
					</span>
					<div class="A-Text-RichText">
						<a href="$CMS_REF(for_page_folder.startNode, abs:2)$">
							<span class="A-Link__linkText">
								$CMS_VALUE(for_element.formData.get(#global.language, "st_name").get())$
							</span>
						</a>
					</div>
				</td>
			
				<td class="M-Table__cell">
					<span class="M-Table__mobileHead">
						Usage and description
					</span>
					<div class="A-Text-RichText">
						$CMS_VALUE(for_element.formData.get(#global.language, "st_description").get())$
					</div>
				</td>
			
				</tr>
					
				$CMS_END_IF$
			$CMS_END_FOR$
		$CMS_END_IF$
		$CMS_END_FOR$
	</tbody>
</table>

This worked fine on the dev system in preview and deployment. I made a feature transport of the changed templates and all the content and moved it to the q system. In the preview there, everything is fine. But when deploying on Q nothing is showing.

The q system does not work with releases, so everything is released and all templates are marked as translated. Can somebody help me find the error?

Best regards,

Nina 

0 Kudos
1 Solution

Accepted Solutions

I got it working. I changed all pageRefFolder.startNode to pageRefFolder.findStartNode. With that, all items are displayed correctly.

I don't really know why getStartNode wasn't working because all startpages are directly in the folder. There are no subfolders or anything. Looks like a strange bug to me.

View solution in original post

0 Kudos
5 Replies
hoebbel
Crownpeak employee

Hello Nina,

my guess is that either the delivering web server is caching (and delivering the old version) or the deployment did not run due to an error.
In any case, I can't see anything in the template code that could cause the preview to work but not the generation.

Check the logfile of the schedule entry. If you can't find the root cause there, check the generated files directly in the file system.

Best regards
Holger

0 Kudos

We tried to find the cause of the error yesterday and added some additional code that always displayed. We could see that on the page after a deployment run, so we can rule out caching and deployment.

I also checked the logs of the deployment job and while we do have 1 error and 5 warnings in the generating task, none of them have anything to do with the overview page I am trying to display here. Deployment job is completely green.

Only thing we noticed is that on Dev we use releases, while on Q no releases are used. But we have no idea if that could have anything to do with anything.

0 Kudos

getChildren fetches the children from the current node. In the preview this is the current state, in generation usualy the release state.
Now it becomes interesting what "The q system does not work with releases" means exactly. Is the release usage disabled in the project, or is the current state generated?

If release usage is disabled (which is not recommended) it means that nothing is released. Then it could be a problem if somewhere explicitly the share state is fetched (because it still exists and it has the content that was there when the option to share was changed).
Is there a place outside the code that calls getChildren and possibly sets "boolean release" to true?
If the generation uses the release state, does it work if the option is disabled?

0 Kudos

Release usage is disabled, because the content of the project is updated regularly by job per feature transport from the corresponding dev project.

Screenshot of project settings 

Deployment job does not use release state.

Screenshot of generation task 

But we tried changing the settings to use release, it updated, seemed to release all elements. We changed the deployment job and deployed after that, with and without extra text, and while deploying it still showed nothing.

Just checked, I could not find any code that sets boolean released to true.

 

0 Kudos

I got it working. I changed all pageRefFolder.startNode to pageRefFolder.findStartNode. With that, all items are displayed correctly.

I don't really know why getStartNode wasn't working because all startpages are directly in the folder. There are no subfolders or anything. Looks like a strange bug to me.

0 Kudos