Back to Page Preview Support

LMBdev
LMBdev

How can we make this preview blog posts? I added:

                  
&& !(
 $widget->getController() instanceof \Rainlab\Blog\Controllers\Posts
)

to the Plugin.php and have the preview icon available now. However, when I click the eye, the modal pops up and gives me an error:

The object you're trying to access doesn't belong to the theme being edited. Please reload the page.

So I'm looking into what is causing this error. Any suggestions?

frozendo
frozendo

Hi,

The Blog plugin already has a real-time content preview. I'm not sure that it's useful to add this feature. It's more complicated than adding a line of code, you'll have to add a new controller that'll handle the POST data to display the page. Probably subclass the Post component in order to display dynamic data instead of the database one.

LMBdev
LMBdev

Hey thanks for the reply. I see in the code that their is a preview button for the Blog plugin. However, I have yet to actually see it displayed when I am creating a post. Any suggestions?

cory.adum16069
cory.adum16069

frozendo, the page preview in blog doesn't account for the layout, but I've made a page that shows unpublished posts to backend users only and it serves the purpose.

Your plugin having this support would simplify this for others.

I might be misinformed of the official support. I'm looking into this https://github.com/rainlab/blog-plugin/pull/316/commits now.

Last updated

LMBdev
LMBdev

What I'm looking at is in _post_toolbar.htm in the Posts controller folder, lines 31-38:

<!-- Preview -->
<a
    href="<?= URL::to($pageUrl) ?>"
    target="_blank"
    class="btn btn-primary oc-icon-crosshairs <?php if (!false): ?>hide<?php endif ?>"
    data-control="preview-button">
        <?= e(trans('backend::lang.form.preview_title')) ?>
</a>

Like I said, I have never actually seen this icon pop up when I am creating, updating, or saving a post. So either something is not setup right on my install or its not actually functioning?

Last updated

kiszna991723396
kiszna991723396

@frozendo does your plugin allow preview for blog posts before publishing? or does anyone know how to do? Please somebody help me out with this...

frozendo
frozendo

Hi @kiszna991723396,

Page Preview doesn't support Blog posts preview yet. It will in the future, but I'm very busy for now with my work, so I will update this plugin in 3-6 months I think. Sorry :(

1-7 of 7