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: How can I preview an Entry on status darft

Status Resolved
Add-on / Version Publisher 2.10.7
Severity
EE Version 5.2.1

Werner Gusset

Feb 03, 2020

I try to figure out how we preview an entry in the CP with the Preview button that has status draft? Entries with status open we can preview. Only entriies with status draft are showing our 404 page instead of the preview template.

There is no Structure or Pages in use. What do we write in the Publisher section for preview templates in column “Preview URI”? The News channel for example has “news/text/{url_title}” for Preview Template. What to enter in Preview URI?

And what is the parameter for status in exp:channel:entries on the preview template? Tried status=“open|draft”.

I have read the docs, but they made me not smarter to solve the problem here. Would appreciate some clarification.

 

#1

BoldMinded (Brian)

If you’re talking about EE’s native preview feature, you need to use https://docs.expressionengine.com/latest/templates/globals/single-variables.html#is_live_preview_request

If you’re talking about Publisher’s preview you need to use status=”{publisher:entry_status}” https://docs.boldminded.com/publisher/docs/draft-workflows#draft-status

#2

Werner Gusset

Thanks Brian

I was trying status=”{publisher:entry_status}” before and switched back. I have done like you suggest. I can only preview open Entries. Draft entries go to our 404 page.

This is the entries tag {exp:channel:entries channel=”news_medienmitteîlungen|news” disable=”category_fields|member_data|pagination” limit=”1” status=”{publisher:entry_status}” publisher_cache=”yes” }

Preview URI Overwrite was empty or filled with “news/text/{url_title}” and it did no difference.

Where do I need to do changes in order to get the preview of draft entries? I have 3 EE 5 / Publisher installs where our customer wants to preview his draft entries. A 4. install is in planning.

#3

BoldMinded (Brian)

I need to know which preview you are using. Are you using EEs native live preview by clicking the blue “preview” button or publisher’s preview by clicking the green “save draft and preview” button?

#4

Werner Gusset

There is no other Button than the blue button for Preview

https://www.dropbox.com/s/6034bu0j9jidopf/draft-preview.png?dl=0

#5

Werner Gusset

I may add that <I can see the the button you mentioned when I set the Dropdown to “Save as Draft”. I click this Save Draft % Preview then, it saves but nothing else happens.

#6

BoldMinded (Brian)

Ok, so that is EE’s native Live Preview, which does work with Publisher (I just tested it on a site a couple weeks ago). {publisher:entry_status} isn’t what you need in this case. You need something like

status=”{if is_live_preview_request}open|draft{if:else}open{/if}”

I don’t think this is related to Publisher at all.

#7

Werner Gusset

Ok, I got this with the status parameter. I also get the links to see with the publisher_key. But I don’t come to see draft entries in preview.

I will make a video to show you what happens.

When I save and preview an entry as draft I get this error message in the preview modal. “An error occurred a nested Bloq field, probably because you forgot to add the {close:[block_name]}{/close:[block_name]} tag pair. Please refer to the documentation.”

Do I save the same entry as published I can preview with the EE preview button and the page is all right with the bloqs. All pages on our site can show the Bloqs ok.

Once an entry is saved as closed. There is no way to save it as draft again. I can only set it to open (or back to cloesed). Is this so by design. I tried the Save as draft select and the status radio “Draft” on the entries Option page. Using the radio “Draft” saves an entry as open.

Do you think a video would help?

#8

Werner Gusset

Comment has been marked private.

#9

Werner Gusset

Comment has been marked private.

#10

Werner Gusset

Comment has been marked private.

#11

BoldMinded (Brian)

Did you see the error message in your video? It’s telling you that there appears to be an error in your Bloqs template code.

#12

Werner Gusset

Yes Brian, of course I see this error message. But it only shows when we try to preview a Draft. All through the website there are no error messages from Bloqs and all pages are displayed as expected. Do we switch the same entry to status open then we can preview it without error message. Isn’t it a bit irritating to get an error when it is on status Draft and not see this Bloqs error when there is status open?

#13

BoldMinded (Brian)

I guess the point I was trying to make is that it appears the logic in your template should be fixed before more action is taken on this ticket as it could have something to do with the issue. I also tested locally and both the native Live Preview and Publisher’s Preview worked fine with Bloqs fields. If you can only preview Open entries, try printing {publisher:entry_status} outside of an entries tag to verify that it is printing “open|draft”.

#14

Werner Gusset

This tag doesn’t output nothing : {publisher:entry_status}

#15

BoldMinded (Brian)

Werner, I just tested this locally and it seems to be working fine: https://d.pr/i/BTHrCb

The template code for this page starts with this:

publisher:entry_status = {publisher:entry_status}
{exp:channel:entries channel="pages" entry_id="{segment_3}" dynamic="no" status="{publisher:entry_status}"}

Have you tried to replicate this in a new/clean EE environment with only Publisher installed?

#16

Werner Gusset

No I haven’t tried it on a fresh install.

I did misunderstand your first instruction to test the output of {publisher:entry_status} and tested it on a template and the browser, not in the preview window. Sorry.

Now I started again, made the special preview template like

Special Preview Template for Testing


publisher:entry_status = {publisher:entry_status}

{exp:channel:entries channel=”test” disable=”category_fields|member_data|pagination” status=”{publisher:entry_status}” } <h1>{title}</h1> {/exp:channel:entries}

Then a created a new entry into this channel without using any Bloqs fields that are present to be used, only a title was entered.

Each time I save it as Draft and Preview it I get that same Bloqs error message that you could see on the video. This is scary as there is no Bloq in use in this entry. You mentiioned to make sure the template code for Bloqs should be right first. It is on my other templates. But the error message is there even without any content in one of the Bloqs fields, and also without any Bloqs code on the template.

The error message is

“Undefined offset: 3 user/addons/bloqs/libraries/EEBlocks/Controller/TagController.php, line 352”

Saving that same entry as open shows the rendered content in the EE Preview like expected.

It is not only EE and Publisher, it is also something with Bloqs.

#17

BoldMinded (Brian)

Comment has been marked private.

#18

Werner Gusset

Comment has been marked private.

#19

Werner Gusset

Comment has been marked private.

#20

BoldMinded (Brian)

The CP user you provided isn’t Super Admin, so I can’t run database queries or even look at the template code, and the FTP info provided doesn’t work either. Please test and make sure the FTP works and files in the add-ons folder are writable.

#21

Werner Gusset

Sorry. Updated data.

#22

BoldMinded (Brian)

I haven’t pinpointed it yet, but if I remove the partials from the blocks field, the preview works fine. e.g.

{page_builder}
{!-- Remove all these {pt_*} partials an it works --}
  {pt_bl_1col}
  {pt_bl_1col_2scol}
  {pt_bl_2col_1row}
  {pt_bl_2col_2row}
  {pt_bl_3cards}
  {pt_bl_txt_table}
  {pt_bl_table_table}
  {pt_bl_img_row}
  {pt_bl_mkto_form}
  {pt_bl_cta_button}
  {pt_bl_h2_title}
  {pt_bl_carousel}
  {pt_bl_fotogalerie}
 {/page_builder}

This leads me to believe there is something happening in one or more of those partials that shouldn’t be happening. Locally, I’ve tested this with 2 Bloqs fields on the page at the same time just like you have setup and I don’t get any errors.

#23

BoldMinded (Brian)

Re-examine those partials, break them down to their simplest forms (remove everything that isn’t necessary to test, and only add 1 atom/field from each block into the code) and see if it changes anything.

#24

Werner Gusset

Does this mean, Publisher looks into the Bloqs fields when previewing a draft even if there are no Bloqs in use in the entry - and more so even if there is no Bloqs code on the template? This is the case with the entry I mentioned 445, it has no Bloqs field used that are options in the entry and there is no code for Bloqs on the preview template. And it is possible to do things that on the live site output it doesn’t throw an error but in Draft prieview it would?

I will see how we can test does partials. Need to work on a copy of the site which is live. But I think it will be difficult to get any insight if even a barely empty page can not be previewed in Draft status and only in open status like the test entry 445. But we will see what we can find out. Just takes some time.

Thanks for your time.

#25

BoldMinded (Brian)

All Publisher does its modify Bloqs queries, it doesn’t alter the rendering in any way. One thing that is very odd and suspicious, is when I add var_dump(count($blocks)); to the TagController->replace() function, which is called once per Bloqs field, it actually var_dumps 14 times, which leads me to believe something is wrong with the template code or it is trying to print more Bloqs fields than you may think it is (perhaps b/c something is wrong with the template code… is it trying to load more entries than expected?)

https://d.pr/i/YBNjMd - See those int(0) that means there are no blocks found, then suddenly it finds 2, then 1, then eventually 5 blocks.

#26

BoldMinded (Brian)

Yeah, your preview template is loading more than you think it is. In Bloqs’ replace_tag, again which is called once per Bloqs field, it is printing multiple entry_ids

This is when I try to preview entry #444. It is clearly trying to load Bloqs fields from more than just entry #444 - https://d.pr/i/1yrPOr

string(3) “445” string(3) “445” string(3) “444” string(3) “444” string(3) “424” string(3) “424” string(1) “8” string(1) “8” string(1) “7” string(1) “7” string(1) “4” string(1) “4” string(1) “2” string(1) “2” string(1) “1”

At this point I can only suspect that your templates are not operating as you expect them to, and you should investigate them a bit more.

#27

Werner Gusset

Ok. I will investigate these templates. I could see now on other templates that draft previews do work.

I don’t mind if this ticket gets closed.

Login to reply