Services Newcastle’s most advanced web company. Learn more ›

Photo of Leevi Graham

Leevi GrahamCode Monkey

Newism Pty Ltd
Newcastle, NSW Australia

ExpressionEngine weblog entry previews with LG Live Look

ExpressionEngine implemented ‘Live Look’ entry previews in version 1.6.1. While a welcome addition, it didn’t quite match our development workflow.

This tutorial will show you how to setup your ExpressionEngine templates to accommodate previewing of unpublished weblog entries inside the publish/edit form using LG Live Look.

LG Live Look is an ExpressionEngine extension that adds a new ‘Live Look’ tab to the publish/edit form in the control panel. The tab contains a preview of the last saved version of an entry, which can quickly be updated using the ‘quick save’ button.

LG Live Look also adds a link to the edit entries table for each entry row. The source of the tab content and the target of the link can be easily customised in the extension settings using a subset of standard {ee} template tag variables (a full list can be found in the documentation).

LG Live Look LG Live Look tab preview in action.

Getting started

The first thing you will need to do for this tutorial is download and install LG Live Look. We’ll activate and configure it in a couple in a later step.

Creating a new weblog and status group

The next part of the setup involves creating a new weblog and status group. If you’re comfortable with ExpressionEngine you should be able to utilise weblogs and status groups from your existing install.

  1. Create a new weblog called ‘Blog’.
  2. Create a new status group called ‘Blog Status Group’.
  3. Create new status in the group called ‘Pending’.
  4. Assign the status group to the weblog.

Creating a new template group

Now there is a new weblog with a special ‘Pending’ status, it will need a new template to show the entry.

  1. Create a new template group called ‘blog’.
  2. Create a new template in the template group called ‘post’.
  3. Inside the ‘post’ template add:
{exp:weblog:entries weblog="blog" limit="1" status="not closed"}
{title}
{/exp:weblog:entries}

The code above is over simplified. It will display all entries that are not closed which includes ‘Open’ and ‘Pending’ entries.

It’s worth mentioning that there is no entry security here, so someone could theoretically guess an entry’s ID and see the in-progress content. If this is an issue for you, consider creating a copy of the primary entry template, using that as your ‘Live Look’ template, and securing the whole thing with Template Access Restriction. Your primary template (the one people see) will only show ‘Open’ entries (status="open") while the new secure ‘Live Look’ template will show ‘Open’ and ‘Pending’ entries (status="open|Pending").

You might also consider using LG Better Meta to tell search engine spiders to not index the page in their search engine results.

Configure the extension

Up until this point nothing ground breaking has occurred. You could just load up the single entry template in a browser tab and view the ‘Pending’ entry. No-one else should be able to find it unless you have a link to it elsewhere in your site.

The next step is to setup LG Live Look, which is a very simple process:

  1. Open the Live Look extension settings.
  2. Under weblog settings display the link and tab for the ‘Blog’ weblog.
  3. Add /blog/post/{entry_id}/{url_title} to the Entry URL field. The two variables will be replaced with the entry specific values.
  4. Save the extension settings.

LG Live Look now knows that the entry will be displayed using /blog/post/{entry_id}/{url_title} as the url. This path will be used as the link target and the iFrame src. There’s a bunch more configuration options and information available in the documentation, so make sure you check that out.

Displaying a preview in the Live Look tab

Before an entry can be viewed in the Live Look tab it must be fully saved at least once. In future versions of the extension I’ll try and find a way around this small workflow hurdle.

To create a new post and preview it inside the LG Live Look tab:

  1. Create a new weblog post in the ‘Blog’ weblog.
  2. Set the status to ‘Pending’
  3. Save the entry.

The entry now is ready to be previewed in the Live Look tab or using the Live Look link.

  1. Edit the entry.
  2. Click the Live Look Tab on the publish form.
  3. Your entry should appear inside the tab content.
  4. Make an alteration to the entry.
  5. Click Quick Save.
  6. Preview the updates in the Live Look tab.
  7. Continue until you are happy and ready to publish.

The final steps

Now that your entry is ready to publish:

  1. Edit the entry.
  2. Change the status to ‘Open’.
  3. Save the entry.

Your article is now available to the public.

The future of LG Live Look

We know not everyone’s workflow is the same as ours, so if you have any suggestions or feedback about LG Live Look, please add them to the comments below. If you enjoy this extension you might consider sharing it with friends on your preferred social network or even writing a short blog post about it.

9/10/08 1:51pm — I have created a support thread over on the ExpressionEngine forums for anyone who is having trouble using LG Live Look.

Comments

The following 24 people were compelled to have their say. We encourage you to do the same.

  1. Ryan Masuga's Gravatar

    Ryan Masuga said on Thursday 9th October, 1:37pm:

    This looks like a fantastic addition to the Control Panel. I have two builds that I will try this out on right away, and I’ll let you know if I come across any issues or have any suggestions.

    Thanks for all your hard work on these addons.

  2. Leevi Graham's Avatar

    Leevi Graham said on Thursday 9th October, 1:45pm:

    @Ryan: Make sure you check out the EE support thread for LG Live Look as there is some information there about using LG Live Look with other LG extensions.

  3. Dave Greiner's Gravatar

    Dave Greiner said on Thursday 9th October, 4:46pm:

    Great feature Leevi, a good live preview is always something we missed in our previous blogging platform. I don’t know how many times I’ve rebuilt posts in Movable Type purely because the formatting wasn’t spot on the first time.

  4. Stefan's Gravatar

    Stefan said on Friday 10th October, 5:22am:

    Thanks Leevi, much appreciated!

  5. e-man's Gravatar

    e-man said on Friday 10th October, 6:34am:

    This is just sick, Leevi :)
    Sometimes I wonder if you sleep at all… will surely test this out on upcoming projects. Cheers!

  6. arthur's Gravatar

    arthur said on Friday 10th October, 7:06am:

    This is amazing. My clients have been asking for an easy ‘preview’ solution for ages. its amazing that EE doesn’t have a feature like this baked in. Great work LG!

  7. Matt's Gravatar

    Matt said on Friday 10th October, 9:17am:

    Really useful. I *just* implemented a “preview” template and status for a client for this exact situation, so having it in their control panel will be perfect.

  8. Sean's Gravatar

    Sean said on Friday 10th October, 1:19pm:

    I’m pretty sure that I will be using this on every single install of EE that I do. Wow! great work

  9. Leevi Graham's Avatar

    Leevi Graham said on Friday 10th October, 1:22pm:

    @Everyone: Thanks for the great feedback so far!

    Just to let you all know I’ll be adding Pages Module support sometime next week if all goes to plan. Subscribe to our RSS Feed for updates.

  10. grantmx's Gravatar

    grantmx said on Friday 10th October, 11:59pm:

    Dope!  This is ranks as one of the essential additions to EE.  Thanks for making it available to us Levi!

  11. Reese Spykerman's Gravatar

    Reese Spykerman said on Monday 13th October, 5:11pm:

    Leevi, I’m stoked. Thank you. So many of my clients are more visually oriented. This addresses that specific need. :)

  12. Davor Peic's Gravatar

    Davor Peic said on Friday 17th October, 1:22am:

    Wow,, this is what is missing, original live lok is ok, but seeing it before publishing is mucho better! Great work Leevi!!

  13. Cameron's Gravatar

    Cameron said on Tuesday 21st October, 7:27am:

    Leevi, might it be possible to have an option to have this workflow:
    * hit save
    * get redirected to the live look tab of the publish screen?

    No idea if the hooks are there, but that would be my ideal if possible.

  14. Leevi Graham's Avatar

    Leevi Graham said on Tuesday 21st October, 9:26am:

    @Cameron: For the next version I’ll try and add some kind of cookie state so that quicksaves automatically show the LG Live Look tab if it was previously open.

  15. Pat Brumfield's Gravatar

    Pat Brumfield said on Saturday 1st November, 4:23am:

    I was just thinking about this very thing the other day, finding myself disappointed that this type of functionality wasn’t built into EE. I’m going to install it right away, thanks for contributing your hard work!

  16. drags's Gravatar

    drags said on Wednesday 10th December, 10:51am:

    Very nice!

  17. Leevi Graham's Avatar

    Leevi Graham said on Sunday 28th December, 5:08pm:

    I’ve just updated LG Live Look and blogged about it here. A couple of bugs have been squashed and some new features have been added.

    Check it out!

  18. Thomas's Gravatar

    Thomas said on Wednesday 4th March, 12:09am:

    This is a great addition to Expression Engine. I had to revert to version 1.0.0 to make it work though. Thanks a lot!

  19. Tim Kremer's Gravatar

    Tim Kremer said on Thursday 5th March, 9:19pm:

    Great news.. I’ll be setting this up straight away!

  20. Leevi Graham's Avatar

    Leevi Graham said on Thursday 26th March, 1:02pm:

    @Thomas: Version 1.0.1 requires that you add jQuery by using either LG Add Sitename (preferred) or CP jQuery. Maybe that was your issue.

  21. Mark Richards's Gravatar

    Mark Richards said on Sunday 26th April, 8:03pm:

    Great site. Thanks for the information.

  22. Liz Lux's Gravatar

    Liz Lux said on Tuesday 28th April, 6:51am:

    Hey there,
    I’m getting this javascript error on my publish page:

    $.cookie is not a function
    admin_publish.js() line 1
    h = $.cookie(“lg_live_look_h”);

    I’ve installed jquery and inserted the link into the header of my admin index page, which corrected the first error I had, which was that JQuery is not a function.  Any tips on why this error is occuring?  Also, I downloaded the LG Add Sitename, but it seemed to hae put the [removed] tag too low in the document for JQuery to be a function.

  23. Jon Reid's Gravatar

    Jon Reid said on Friday 5th February, 11:25am:

    Leevi,

    I installed version 1.1.0 and I have Live Look working from the edit listing page.

    When I click the Live Look tab on the Publish or Edit page however the Live Look area is always blank.

    Any suggestions?

  24. Jon Reid's Gravatar

    Jon Reid said on Friday 5th February, 1:25pm:

    I reverted to version 1.0.0.  It works :)

Your comment

Please keep your comments friendly and on topic.

Your info
Your comment