Jump to content
Joss

Previewing bits of an article on my site

Recommended Posts

Okay, so I think I know how to do this, but I can't quite get my head around it.

When I publish an article on a site I am nailing together, it appears in various listings around the site - homepage, list of recipes, whatever.

While it is unpublished, I want to be able to preview it in its various guises, not just the main article.

I think it should be something like if logged in user=author, erm, also display unpublished articles by this author, or something.

Though, of course, that might bring up a lot of rubbish too - all those unpublished articles I haven't got around to finishing.

I suppose I could add a "preview" checkbox so that it will only display the various bits from an unpublished article if this checkbox is also selected.

if logged in user=author, also display unpublished articles by this  author where preview=1, or something else?

Is this making any sort of sense to anyone?

Diogo? Are you out there? You are normally good with my ramblings!

Share this post


Link to post
Share on other sites

Are we talking about an 'in-context' preview or something slightly else? In other words, if author is logged in and preview=1, show appropriate unpublished items as if they were published to world+dog? Seems a very reasonable thing to do.

When I first read the OP, I wondered if you were talking about some kind of 'preview' template, just to show the different ways an article might appear across the site, but in-context is probably better.

You'll just need to check if one or more unpublished items should be included in the page and adjust any content selectors appropriately, obviously depending on whatever output strategy is in use. It might also be helpful, either in an admin module or an extra bit injected into the site output to list the urls where the content in question can be seen, to help the preview process.

 

Share this post


Link to post
Share on other sites

hmm... maybe you could hook page::viewable? something like

hookafter page::viewable
if($page->isUnpublished() AND $page->previewcheckbox == 1 AND $page->createdUser == $user) $event->return = true;

i would also create a hook to remove the preview checkbox for all pages that were edited more than 1 hour ago (or 1 day)

Share this post


Link to post
Share on other sites

Dave - yep, in context. That was the phrase I was looking for!

 

Bernhard - that might do it. I rather like that idea of removing checkbox values. Could save clutter.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...