We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Live preview not working at all with 4.1.0-dp3

Developer Preview

Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

The live preview button is no longer displaying in the publish page.

Also, and this may be unrelated, but I tried creating a new entry in the same channel and got a list of errors:

Notice Undefined variable: site_id ee/EllisLab/Addons/pages/tab.pages.php, line 316

Severity: E_NOTICE Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:111) ee/legacy/core/Input.php, line 233

Severity: E_WARNING Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:111) ee/legacy/core/Input.php, line 233

Severity: E_WARNING Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:111) ee/legacy/libraries/Functions.php, line 392

Severity: E_WARNING

This was an update from -dp2 and not a fresh install. If that helps.

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
7 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

Assuming you have the Pages module installed, refer to this: https://expressionengine.com/forums/topic/251174/live-preview-errors-with-4.1.0-dp3

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

For the Live Preview button in system/ee/EllisLab/ExpressionEngine/Controller/Publish/AbstractPublish.php replace the getPublishFormButtons function starting at line 427 with:

protected function getPublishFormButtons(ChannelEntry $entry)
 {
  $buttons = [
   [
    'name' => 'submit',
    'type' => 'submit',
    'value' => 'save',
    'text' => 'save',
    'working' => 'btn_saving'
   ],
   [
    'name' => 'submit',
    'type' => 'submit',
    'value' => 'save_and_new',
    'text' => 'save_and_new',
    'working' => 'btn_saving'
   ],
   [
    'name' => 'submit',
    'type' => 'submit',
    'value' => 'save_and_close',
    'text' => 'save_and_close',
    'working' => 'btn_saving'
   ]
  ];

  // get rid of Save & New button if we've reached the max entries for this channel
  if ($entry->Channel->max_entries != 0 && $entry->Channel->total_records >= $entry->Channel->max_entries)
  {
   unset($buttons[1]);
  }

  $has_preview_button  = FALSE;
  $show_preview_button = FALSE;

  if ($entry->hasLivePreview())
  {
   $has_preview_button  = TRUE;
   $show_preview_button = TRUE;
  }

  $pages_module = ee('Addon')->get('pages');
  if ($pages_module && $pages_module->isInstalled())
  {
   $has_preview_button = TRUE;
   if ($entry->hasPageURI())
   {
    $show_preview_button = TRUE;
   }
  }

  if ($has_preview_button)
  {
   $extra_class = ($show_preview_button) ? '' : ' hidden';

   $buttons[] = [
    'name'    => 'submit',
    'type'    => 'submit',
    'value'   => 'preview',
    'text'    => 'preview',
    'class'   => 'action js-modal-link--side' . $extra_class,
    'attrs'   => 'rel=live-preview',
    'working' => 'btn_previewing'
   ];
  }

  return $buttons;
 }

In system/ee/EllisLab/Addons/pages/tab.pages.php at line 311 add

$site_id    = ee()->config->item('site_id');
       
Kurt Deutscher's avatar
Kurt Deutscher
827 posts
7 years ago
Kurt Deutscher's avatar Kurt Deutscher

OK, preview button now showing. Using it though, I get these notices in the preview space/window above the page:

Notice Trying to get property of non-object ee/EllisLab/ExpressionEngine/Controller/Publish/Publish.php, line 392

Severity: E_NOTICE Notice Trying to get property of non-object ee/EllisLab/ExpressionEngine/Controller/Publish/Publish.php, line 392

Severity: E_NOTICE Notice Trying to get property of non-object ee/EllisLab/ExpressionEngine/Controller/Publish/Publish.php, line 393

Severity: E_NOTICE Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:111) ee/EllisLab/ExpressionEngine/Boot/boot.common.php, line 487

Severity: E_WARNING

I have debugging turned on, and there’s nothing showing at the actual page URL, only when in preview.

       
Derek Jones's avatar
Derek Jones
7,561 posts
7 years ago
Derek Jones's avatar Derek Jones

See Pedro’s link above for those errors, Kurt, thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.