Thread

Live preview not working at all with 4.1.0-dp3

February 26, 2018 7:12pm

Subscribe [3]
  • #1 / Feb 26, 2018 7:12pm

    Kurt Deutscher's avatar

    Kurt Deutscher

    825 posts

    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.

  • #2 / Feb 27, 2018 6:16am

    Pedro Guimaraes's avatar

    Pedro Guimaraes

    170 posts

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

  • #3 / Feb 27, 2018 11:35am

    Seth Barber's avatar

    Seth Barber

    172 posts

    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');
  • #4 / Feb 27, 2018 12:01pm

    Kurt Deutscher's avatar

    Kurt Deutscher

    825 posts

    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.

  • #5 / Feb 27, 2018 12:14pm

    Derek Jones's avatar

    Derek Jones

    7391 posts

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

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases