I’m in the process of creating a new extension that gives a true preview of an entry, even if the entry is posted for a future date. Here are the features (so far): -Adds a “View Preview” link to the View Entry screen (the one you see right after Submitting or Updating an entry) -Allows you to define which template group to use for each weblog you have -Uses the exact template you use on your site (even for future entries) which eliminates the need to maintain separate preview templates.
I would like to have some outsiders test this for usability and bugs. I have attached the files you’ll need (ext.viewpreview.php and lang.viewpreview.php).
Installation Instructions: 1. Download the files and upload them to the /extensions and /language/english directories. 2. Go to your Admin > Utilities > Extensions Manager page and Enable the View Entry Preview extension 3. Click on the Settings link and enter the appropriate templategroup/templatename into the corresponding weblog fields 4. Hit the Submit button (Note: The extension will not work if you don’t hit submit - I hope to fix this soon) 5. MOST IMPORTANT STEP - You must make one teeny, tiny change to your entry templates. This change will not (or shouldn’t at least) effect anything on your site or anything else for that matter. The change requires adding to your {exp:weblog:entries … } tag the “dynamic_parameters=”show_future_entries”” parameter. As an example, let’s say your template currently contains {exp:weblog:entries weblog="my_blog"}….you’ll need to change this to {exp:weblog:entries weblog="my_blog" dynamic_parameters="show_future_entries"}. This step is crucial because it allows you to preview future entries only when the “show_future_entries” parameter is passed to the template via a POST request.
That’s it, you’re ready to view some previews. To view a preview, go to your “Edit” tab and click the “View” link next to one of your entries. You’ll then see the “View Preview” link at the bottom.
Please let me know if you find any strange behaviors or if this doesn’t work for you? I plan on making it more robust by including a Preview link in other places (like the Edit page, perhaps a tab on the Publish form, etc)
Also, any recommendations are greatly appreciated!
UPDATE: Duuuhhh… I had a variable hardcoded. I’ve updated the download with the new change.
Thanks,
-Brett
Hey Brett, thanks for sharing the ext-in-progress, it’s looking great.
Some quick notes:
line #40, you don’t use $PREFS, so no need to global it. line #64, you don’t use $PREFS, so no need to global it, instead global $FNS; line #70, hardcoded url “http://www.converssation.com/”, change to this: $FNS->create_url($template); line #85, you don’t use $PREFS, so no need to global it. line #93, to preset settings you can serialize() an associative array instead of having the settings column empty on install.
I think that’s all I could see, this EXT seems very helpful. I’d love to see this implemented on the EDIT tab also.
best Andy
Hi Brett,
Just downloading now. Looks like it will be a good one so thanks for that! Will have to try out in a couple of days though as have a really difficult job I am working with at the moment!!
Andy I don’t know if you know or not but just took a look at your site and it seems as though the CSS isn’t working properly. I am using Safari on Mac OSX 10.4.6 (MacBook Pro). Just thought I would give you a quick heads up! Also Andy do you have a complete list anywhere of all the modules, plugins and extensions that you have made for EE. I would be interested in looking at that if you do. Thanks.
Again Brett thanks for creating this. If I have understood the description correctly then it will help me out no end.
Thanks.
Mark
Gah, I’m afraid I can’t get it working. I don’t see the hardcoded url in the code so I’m assuming it was changed before I downloaded. I get a blank screen when I hit “view” from the edit tab or “update” from the entry form.
From what I can see from what is working and your description, I’d find this most useful if it basically transformed the “preview” button from the entry form page into the actual page view - but in a new window. I imagine that’s more complex though. I’d want to have my preview screen and my entry form screen open at the same time.
I can see how this would be useful if an editor or a second set of eyes was checking entries before publication - the person could go through a bunch of entry views quickly this way and easily navigate to the entry form if a change needed to be made.
ruraldreams: The “dynamic_parameters” parameter is a standard ExpressionEngine entries parameter. It allows you to pass variables via a POST request to your page. This could be useful for passing a specific date range, etc. For more information, visit the EE support page on Dynamic Parameters.
As for not getting it to work I apologize. I hastily uploaded an incomplete version. I have updated the download at the top with the most recent version. It contains a few features that are still in the works, but overall it works fine. The installation instructions are the same as the original instructions. The following are the new features:
Thanks for the dynamic parameters link - I’d never seen that before and I actually did a search for it before I posted!
Well I’m getting somewhere… I have the view preview link in my edit tab (as in your screenshot) but I don’t see anything anywhere else. Is there supposed to be a link from the cp preview page? Maybe I’m misunderstanding something.
It’s not pulling the correct template group/template from the extension settings. I’m getting your default instead of the one that I’ve specified. I’ve checked it twice and been sure to submit.
Another thing is about creating a conditional based on the entry date to indicate whether something has published or not. I think that folks sometimes use status instead of date for this. Don’t know how you would manage that but I thought I’d mention it.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.