Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Layouts

Status Resolved
Add-on / Version Publisher Lite 3.1.3
Severity
EE Version 5.3.0

Bryan Dion

Mar 04, 2020

I can’t seem to get layouts to work with Publisher preview. When I use EE native preview, they are parsed and displayed correctly but when Publisher is active, it seems to break the layout:set code. Even something as simple as

{layout:set name="page_title"}Test{/layout:set}

Renders as just
Test{/layout:set}

Let me know if you need a test site.

 

#1

BoldMinded (Brian)

Hi Bryan. The info you provided doesn’t really give me much to go on. Can you attach screenshots of your preview settings page, and maybe a video of you saving an entry and expecting to see the preview?

#2

BoldMinded (Brian)

Did you read the docs and use the {Publisher:entry_status} variable in the entries tag in the template for your preview? Also a full example of the template you’re trying to use in your preview would help.

#3

Bryan Dion

I uploaded two screenshots to the original ticket. One shows the page as published and the second shows when I hit the same url with ?publisher_status=draft as you can see the main content (which is bloqs) loads fine but anything in {layout:set} gets messed up. I’ve even narrowed my code down to just the below. The channel I have it on is controlled by structure and all draft settings for publisher are the default. It loads the correct preview template but just seems to strip the first {layout:set} tag.

{layout="layouts/_main"}

{exp:channel:entries channel="pages" limit="1" require_entry="yes" status="not closed"}
 {layout:set name="page_title"}{title}{/layout:set}
   
 {content_blocks}
  {content_blocks_partial}
 {/content_blocks}

{/exp:channel:entries}
#4

BoldMinded (Brian)

I’m pretty certain the layouts don’t have any effect on the previews. The preview is a full page render. I have a site that uses the layout bars heavily and they work just fine in the previews.

#5

BoldMinded (Brian)

It looks like you’re missing the status global variable. Please take a look at the docs https://docs.boldminded.com/publisher/docs/template-tags

#6

Bryan Dion

Brian,

I think this may be something wonky with my test environment as I tried it on my local and it’s working as expected now.

#7

Bryan Dion

Comment has been marked private.

#8

BoldMinded (Brian)

Can you paste the layout and template file code in this ticket, and provide a video exhibiting the issue? Even though I provide fields to provide site login info, logging into someone’s site is the last thing I do and only when absolutely necessary. Also, the link to the page with ?publisher_status appears to include the entire template logic. In order for me to debug anything it needs to be stripped down to the bare necessities to replicate the issue. Strip out all additional html, css, js, or other add-on code, or custom field code that does not apply to replicating the issue. Having that stuff in there is just noise when debugging. Also, if it starts working again after you’ve stripped it down, it might actually reveal a conflict or an issue with your template logic. I have an example in my dev environment using Bloqs, layout templates, layout variables, and it works without issue, which at this point leads me to believe there is a flaw in your template logic. If you can re-create the issue with a bare bones template as mentioned, then it might indicate an issue with Publisher, but right now there are too many variables at play in a full complicated template that might be causing the issue.

#9

Bryan Dion

Comment has been marked private.

#10

BoldMinded (Brian)

Did you try backing up your db, uninstalling Publisher, then seeing if it works?

#11

BoldMinded (Brian)

Also try changing your Bloqs field name from content_blocks to something else not containing “content” - I’ve just tested basically the exact same template code and it works fine for me locally, and it also works in a large production site as well running Publisher and Bloqs.

#12

Bryan Dion

Brian, I got it resolved by uninstalling and reinstalling. The first time I installed it I didn’t get the notification about a second step and it never alerted me about this second step, even in the diagnostics. This time when I reinstalled it, I got the second step, ran through it and the previews are no longer breaking. Thanks for your help.

#13

BoldMinded (Brian)

Well that is interesting, but I can see how that might cause the issue if the entry you were trying to view wasn’t migrated correctly. After you installed, did you get redirected to the license page immediately?

#14

Bryan Dion

I spoke too soon. It worked for a few times and now back to breaking my layout variables. So bizarre. I’m going to take a look at it again tomorrow. It didn’t redirect me as i needed to comment out the line 2119-2121 in your latest release. I was getting undefined ‘App’ errors on that if statement when I upgraded to 3.1.3 from 3.1.2

#15

BoldMinded (Brian)

I’m still unable to replicate this. Have you tried setting up a brand new EE environment with Bloqs and Publisher installed to replicate the issue?

#16

BoldMinded (Brian)

Comment has been marked private.

#17

Bryan Dion

Comment has been marked private.

#18

BoldMinded (Brian)

Make sure you have upgraded Bloqs too. Any other of my add-ons installed? If so make sure you have the latest versions of them too.

#19

Bryan Dion

Forgot I had Reel installed, updated to latest version and that error is gone. Now back to the original issue. I’m going to start eliminating all other addons/extensions and see what I can find out.

#20

Bryan Dion

I went ahead and uninstalled every module except BM’s and a couple of EEHarbor ones. I’m still getting the same issue where previewing drafts strips all the layout:set starting tags. Using preview for the published version works just fine but publisher preview always gets stripped. I’ve removed all the bloqs code as well and just using the title field. Even just

{layout="layouts/_test"}

{exp:channel:entries channel="pages" limit="1" require_entry="yes" status="{publisher:entry_status}"}
 {layout:set name="header_title"}
  {title}
 {/layout:set}
 
 <h1>{title}</h1>

{/exp:channel:entries}

Produces broken layout tags. I’ve even tried changing PHP versions.

#21

BoldMinded (Brian)

Did you try the same template code without Publisher installed at all? Just change status=”open” and uninstall Publisher and Bloqs and see what happens.

#22

Bryan Dion

I went ahead and uninstalled everything and cleared out as much as possible. Still kept having the issue and then I finally narrowed it down to the Diff settings in publisher. When the frontend diff is enabled the layout is breaking for me, with it off it seems to work consistently. This is definitely a feature we want to use so I need to get this sorted out. I tried the text only diff but that failed as well. I know in the docs you list that diff don’t work in layout:set but I didn’t think it would break the display.

#23

BoldMinded (Brian)

Ah, I forgot that was a possible side effect. Unfortunately though I’m at the mercy of the library used to create the diffs. This only happens when using the EE’s native Live Preview, not when viewing a draft on the front-end or using Publisher’s Preview option?

#24

Bryan Dion

All 3 show the broken template code.

The weird part is if I enable CP diffs, it still breaks the preview. I figured CP diffs would leave the preview and frontend template alone. Also a quick note that next to Frontend Diffs, it says it requires ?status=draft in the url but shouldn’t that be ?publisher_status=draft

#25

BoldMinded (Brian)

EE’s previews are deceptive, it’s a front-end request, but it doesn’t go through entirely the same pipeline as a normal full front-end request. I may have to add a conditional in Publisher to not parse CP diffs if it’s a Live Preview request.

#26

BoldMinded (Brian)

Comment has been marked private.

#27

Bryan Dion

That seemed to do the trick. I can see diffs on the frontend and it doesn’t break my layouts. I dove a little into the code to see the frontend and it appears that it breaks when it attempts to parse_globals but the lack of a layout in the code (your addon strips it and just sends the channel entries) being parsed at that point causes the broken code. I don’t see an easy way around that so I understand the lack of supporting that feature with layouts involved. Thanks for the help on this.

#28

BoldMinded (Brian)

Can you point out the lines of code you’re referring to?

#29

Bryan Dion

Line 193 in Service/Diff.php

ee()->TMPL->parse_globals(ee()->TMPL->template);

Login to reply