10th
Feb 2010
Posted by Marty Romero
Categorie(s): Tutorials ExpressionEngine

One of the gripes I have with
ExpressionEngine is that it doesn't give you a true preview of an entry.
ExpressionEngine will show you the content inside of the control panel, but it is not a representation of what it will visually look like on your site. In order to see what your entry is actually going to look like you have to set the status to "open" and view your entry on your live site. That means having to release your entry into the wild, without being sure if you like how it looks. You can use
Leevi Graham's LG Live Look extension to give
ExpressionEngine the ability to display a true preview of an entry, but I don't think the extension has been ported over to EE 2.0. I will show you a way to get around this using
ExpressionEngine' conditional tag
if and a custom entry status.
The Problem
The problem with setting an entry's status to "open" when you only want to see what it's going to look like, is that it becomes viewable to anyone who happens to be browsing your site at that moment.
The Solution
Using
ExpressionEngines' "Custom Entry Status" and the
if conditional tag, you can tell
ExpressionEngines to display entries with a custom status only to you and only if you are logged in (which you probably will be if you are writing/editing an entry). This is how you do it.
- In ExpressionEngines 2.0, go to Admin>Channel Administration>Custom Status Groups and add a new status--I named my new status "Preview," but you can name it what ever you want.
- Create a new entry and set the status to "Preview" (or what ever you called the new status you created in step 1).
- In your template, duplicate the exp:channel:entry tag that displays the entries and add a status="preview" parameter.
- All you have to do now is wrap the duplicated channel:entries tag with a conditional if statement, like this if username == “your_username”.
Now you can publish your entry and preview it on your site without anyone else seeing your work in progress.
1 comments
On February 16th, 2010 at 4:30 AM
MarmaladeToday thought that:
You should also be able to get an in context view of your post in an appropriate template by using the ‘Live Look’ functionality EE provides.
Edit the preferences for the weblog/channel you want to be able to preview to select whichever template you want to use to ‘Live Look’ that weblog/channel, and then a ‘Live Look’ link should appear on your Edit screen in the control panel under the View column for those entries. Clicking on that should show your entry in all its glory, in the template you’ve specified.
That said, I’ve also used the technique you outline sometimes.