True Entry Preview In 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 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.
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.