Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-03 00:41:20

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

[request] Preview article with proper CSS

Hi,

I know we can create a dummy section and post the article to there, but I’d like to see a plugin that would generate a popup with the article using the CSS being used in the section you’re writing to.

I think a popup would make things faster, rather than having to open another tab and keep bouncing back to article edit.

Plugin ransom available upon request.

Offline

#2 2006-09-03 03:23:27

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [request] Preview article with proper CSS

It would also have to use part of your markup as well, unless you have a really basic CSS file.

Offline

#3 2006-09-03 12:14:20

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: [request] Preview article with proper CSS

Yes, it would have to use the markup that contains the article. In my case, preview doesn’t work well for articles where I wrap text around an image, so I’d like to see how it all would look.

Maybe we could copy/paste the CSS that’s related to the article into the plugin’s options. I don’t care to see my whole site, just the div that contains the article, if that’s possible.

Offline

#4 2006-09-04 03:58:35

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [request] Preview article with proper CSS

Maybe we could copy/paste the CSS that’s related to the article into the plugin’s options. I don’t care to see my whole site, just the div that contains the article, if that’s possible.

Yep.

Offline

#5 2008-05-15 22:49:55

alannie
Member
From: Minnesota, USA
Registered: 2005-09-15
Posts: 150

Re: [request] Preview article with proper CSS

Did anyone ever address this request? I’m very interested in this as well.

Offline

#6 2008-05-15 23:27:46

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: [request] Preview article with proper CSS

Hey, a thread I started!!

alannie,

You can save your article with a future date, then you’ll see a View link next to the title of the article. Clicking the View link lets you see your article but it won’t show on your site, due to the date. When you’re ready to go live, click the More link, bottom right, check Reset time to now… and save the article.

That’s what I do.

Offline

#7 2008-05-15 23:34:39

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [request] Preview article with proper CSS

Very clever…
So, if it’s published to the future and even if that date haven’t arrived yet, but you know the url-title value, you can see it?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2008-05-16 00:18:36

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: [request] Preview article with proper CSS

maniqui, si.

Offline

#9 2008-05-16 00:36:18

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [request] Preview article with proper CSS

I was thinking about doing some magic with <txp:rvm_privileged />.

<txp:rvm_if_privileged>
    <!-- display articles with status="pending" -->
    <p class="previewing">You are previewing a list of pending articles. Click on any permanent link to see it on its individual URL. If you like how it looks, set its status to "Live".</p>
    <txp:article status="pending" />
</txp:rvm_if_privileged>
<txp:article />

If this works (haven’t tested, so this can be a total deception), it has the advantage of displaying the article on article lists too.

Last edited by maniqui (2008-05-16 00:39:18)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2008-05-16 06:40:45

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: [request] Preview article with proper CSS

maniqui wrote:

If this works (haven’t tested, so this can be a total deception), it has the advantage of displaying the article on article lists too.

that’s a good idea. i guess you’re going to let us know if it does work, right? :)

Offline

#11 2008-05-16 07:20:28

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [request] Preview article with proper CSS

hi Sven,

tested.
worked. :)
but just the half. :(

Any article with status set to “draft”, “hidden” or “pending” returns a 404 when trying to access to its individual article URL. Let’s think if there is any solution about that…

So, the snippet works on article lists (that’s the half that worked).
This is an improved snippet, using chh_if_data to avoid output if there isn’t any pending article:

<txp:rvm_if_privileged>
    <!-- display articles with status="pending" -->
<txp:chh_if_data>
    <p class="previewing">You are previewing a list of pending articles. Clicking on permalink won't work. If you like how it looks, set its status to "Live".</p>
<div style="outline-top: 4px solid red;outline-bottom: 4px solid red">
    <txp:article status="pending" />
</div>
</txp:chh_if_data>
</txp:rvm_if_privileged>
<txp:article />

I’ve added an inline style just for testing (an outline, because it doesn’t take “physical” space) and just to have some “visual aid” on previewing pending articles.

We may have a problem here if Txp developers decide to change current behavior of txp:article status="pending". I think I’ve read more than once that ruud (or wet? or the old zem?) considered this behavior a bug, and that draft/hidden/pending articles should never be displayed, and in fact, that’s what happens on an individual article context: they return 404.

Another way that should work (fully work this time): a mix between the above snippet and the idea suggested by Bert. Setting article time to future, and using this version of the snippet:

<txp:rvm_if_privileged>
    <!-- display articles with status="live" and time set to future -->
<txp:chh_if_data>
    <p class="previewing">You are previewing a list of live articles with timestamp set to future. Click on any permanent link to see it on its individual URL. If you like how it looks, resets its timestamp to now.</p>
<div style="outline-top: 4px solid red;outline-bottom: 4px solid red">
    <txp:article time="future" />
</div>
</txp:chh_if_data>
</txp:rvm_if_privileged>
<txp:article />

Another similar one that should work too: set status to sticky (sticky articles can ve viewed on individual article context). Probably, this will work the best if you are not using sticky articles in other places of your template.

<txp:rvm_if_privileged>
    <!-- display articles with status="sticky" -->
<txp:chh_if_data>
    <p class="previewing">You are previewing a list of sticky articles. Click on any permanent link to see it on its individual URL. If you like how it looks, set status to "Live".</p>
<div style="outline-top: 4px solid red;outline-bottom: 4px solid red">
    <txp:article status="sticky" />
</div>
</txp:chh_if_data>
</txp:rvm_if_privileged>
<txp:article />

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#12 2008-05-16 07:45:23

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [request] Preview article with proper CSS

We may have a problem here if Txp developers decide to change current behavior of txp:article status=“pending”. I think I’ve read more than once that ruud (or wet? or the old zem?) considered this behavior a bug, and that draft/hidden/pending articles should never be displayed, and in fact, that’s what happens on an individual article context: they return 404.

Very true. But if we change this behaviour, rest assured that you’ll also get a better way to preview articles (I have some ideas on how to implement that).

Offline

Board footer

Powered by FluxBB