Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[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.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
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
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.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
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
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.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
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?
Offline
Re: [request] Preview article with proper CSS
maniqui, si.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
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)
Offline
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
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 />
Offline
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