<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://mg.to" xmlns:dc="https://purl.org/dc/elements/1.1/">
<channel>
 <title>mg.to - Drupal preview confusion - Comments</title>
 <link>https://mg.to/2005/03/13/drupal-preview-confusion</link>
 <description>Comments for &quot;Drupal preview confusion&quot;</description>
 <language>en</language>
<item>
 <title>Drupal preview confusion</title>
 <link>https://mg.to/2005/03/13/drupal-preview-confusion</link>
 <description>&lt;p&gt;If you use &lt;a href=&quot;https://www.drupal.org/&quot;&gt;Drupal&lt;/a&gt;, you&amp;#8217;ve probably had this happen: You edit a post, preview it and double check it to make sure it&amp;#8217;s perfect, and then come back later to find all your work is gone. Then you remember: You didn&amp;#8217;t actually &lt;em&gt;save&lt;/em&gt; your post, you just previewed it.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve done it more than a few times. But when my boss had it happen to him on our new in-house Drupal site, I figured I&amp;#8217;d better do something about it.&lt;/p&gt;

&lt;p&gt;There are two problems here, one architectural and one cosmetic. The architectural problem is that Drupal, like so many web-based systems, does not save your work on the server at all when you are editing and previewing. If you just preview and forget to save, your work is lost.&lt;/p&gt;

&lt;p&gt;That would take some design effort to fix, but maybe we can fix the cosmetic problem: Drupal&amp;#8217;s preview page looks too much like a normal page view.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a typical Drupal page:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mg.to/images/drupal-simple-page.png&quot; alt=&quot;Drupal page display&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you edit the page and preview it, it looks like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mg.to/images/drupal-simple-preview.png&quot; alt=&quot;Drupal page preview&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This hardly looks any different from the regular page display. No wonder it&amp;#8217;s easy to forget to save the page.&lt;/p&gt;

&lt;p&gt;One would think we could use a little bit of CSS in a Drupal theme to style the preview differently. But in searching the Drupal 4.5.2 and 4.6.0RC code, I couldn&amp;#8217;t find any way to do this. Drupal just doesn&amp;#8217;t mark the preview in any way that I could find to make use of from CSS.&lt;/p&gt;

&lt;p&gt;But if we add one line of code to a couple of Drupal core modules, we can then do a bit of work in the Drupal theme to get this preview page:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://mg.to/images/drupal-simple-preview-styled.png&quot; alt=&quot;Drupal page preview with styling&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With the heavy dashed red border and shaded background, the preview won&amp;#8217;t be mistaken for an ordinary display page.&lt;/p&gt;

&lt;p&gt;Coding details and an updated version of the FriendsLight theme are on my &lt;a href=&quot;https://mg.to/2005/03/13/friendslight-theme-with-styled-preview&quot;&gt;Drupal test site&lt;/a&gt;.&lt;/p&gt;
</description>
 <comments>https://mg.to/2005/03/13/drupal-preview-confusion#comments</comments>
 <category domain="https://mg.to/topics/software/drupal">Drupal</category>
 <pubDate>Sun, 13 Mar 2005 01:27:13 +0000</pubDate>
 <dc:creator>Michael Geary</dc:creator>
 <guid isPermaLink="false">72 at https://mg.to</guid>
</item>
</channel>
</rss>
