OK. In this case, you need to move the layout inside the conditional to your previewpost template. It is under Ungrouped Templates. Create a new previewpost with a prefix.
Leave the contents inside the else condition in your Display Format.
Remove other additional code there. So, it will like the code before you edit the Display Format.
The contents of your Display Format should be only like this:
RateU, you are indeed an awesome chap. If I could think of a way to help you as much as you have helped me (indeed all of us) I would. Right now, all I can offer is Thank You.
No, Lee. It is my mistake that my stupid brain not thinking about other {$GLOBALS['threadfields']['key']['value']} variable in postbit as soon as possible when I see your attachments. How stupid I am!!!
The reason why it happens to you is, the preview post calls postbit template. So, if we have the {$GLOBALS['threadfields']['key']['value']} variable in our postbit template, the conditional "can't block" it, because it is still in newthread page. It's a bit hard for me to explain it
I've added other solution in above post if you encounter the same problem. Maybe more flexible and simple. But if the previous solution has solved the problem, I think it is not needed.
I saw the second solution I like it - its more elegant somehow. I shall use that solution. Hopefully this thread will be good for another Xthreads user who has used postbit _first for the variables and likes the post preview idea.
Gladly XThreads provides us the "partial" variable to "compose" the {$GLOBALS['threadfields']['key']['value']} variable "manually" using {$GLOBALS['threadfields']['key']['item']}. We can feel it that it is very flexible
Trying this it, it appears that "this.form" isn't always an object (in Opera).
Probably document.getElementById() is more reliable (with changes in ID).
Well, after several hours of trying I cannot get this to work when editing my post - I already reported it and Zinga says he gets it to change no problem.... I don't get it at all. This is my post from the other day (and Zinga's reply)
(10-26-2010 11:31 AM)leefish Wrote: Hi
I am using a template modification posted by RateU to show preview images of uploaded attachments. Link to modification
I received a report from a user that the preview function when editing a post only shows the new attachment image once the post has been updated (i.e. posted on the forum).
If they click preview post before that then the old image is still showing in the preview even though they have chosen a replacement image. It would make more sense if it showed the updated image, though I do realise they have not yet actually attached the replacement - only indicated they wish to do so. I was wondering if this would be something that I could change in the template or if it was part of the Xthreads code?
(10-26-2010 08:15 PM)ZiNgA BuRgA Wrote: I can't seem to reproduce this with MyBB 1.6 and XThreads 1.32.
Did the modification, made a thread with an attached image, did a full edit. Ticked the replace checkbox, selected a new image and hit preview post. The new image displayed for me...
So, in order to get this to work I moved my images to the showthread template instead of first post and removed the else statement in my Custom Thread Field - its the same as before - no change in the preview and I have the code in my Custom Thread Field Display format exactly as in Rateus template in this thread (except that my image key is called pfpic not img).
I have a customised New Thread Template and a customised Edit Thread Template. I did not edit the post preview template as I am trying to keep as close to RateU's original set up as I can.
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->edit_post}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
{$preview}
{$post_errors}
{$attacherror}
<form action="editpost.php?pid={$pid}&processed=1" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tbody>
<tr><td class="thead" colspan="2"><strong>LeeFish Upload Wizard</strong></td></tr>
<tr>
<td class="trow_sep" colspan="2">
<div class="float_left" style="margin-left: 19px;">Item Name:</div>
<div class="float_left" style="margin-left: 9px;"><input type="text" class="textbox" name="subject" size="50" maxlength="85" value="{$subject}" tabindex="1" /></div>
</td>
</tr>
<tr><td class="tfoot" colspan="6"><strong>Required Information</strong></td></tr>
<tr>
<td class="tcat" colspan="6" style="smalltext">
<div class="smalltext"><em>Select the information for your upload from the dropdown boxes. You can select multiple EPs - hold CTRL and choose the EPs. Be careful which base game you choose....</em></div><br/>
</td>
</tr>
<tr>
<td class="trow2" colspan="6">
<div class="float_left">Game:</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['prefix']}</div>
<div class="float_left" style="margin-left: 19px;">EP(s):</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['dld_ep_prefix']} </div>
<div class="float_left" style="margin-left: 19px;">Category:</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['pfcat']}</div>
</td>
</tr>
</tbody>
<tbody>
<tr><td class="tfoot" colspan="8"><strong>Screenshots</strong></td></tr>
<tr>
<td class="tcat" colspan="8" style="smalltext">
<div class="smalltext"><em>You can have up to 4 screenshots - file size is max 200kb, max dimensions 1000*800. Accepted images formats are png, gif and jpg. Images will only be shown full size in the light box - please do not use large images inline with the text as it will break the layouts - instead, use the preview post button and select the bbcoded large thumb to use in the main body. If you get an <strong>attachment error</strong> please check that you have correct FILE TYPE, DIMENSIONS and FILE SIZE.</em></div>
</td>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>Screenshot 1: | This is your preview thumbnail</div></td>
<td class="trow1" width="50%"><div>Screenshot 2: | Optional picture</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['pfpic']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['pfapic1']}</div></td>
</tr>
<tr></tr>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>Screenshot 3: | Optional picture</div></td>
<td class="trow1" width="50%"><div>Screenshot 4: | Optional picture</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['pfapic2']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['pfapic3']}</div></td>
</tr>
</tbody>
<tbody>
<tr></tr>
<tr><td class="tfoot" colspan="8"><strong>File Upload</strong></td></tr>
<tr>
<td class="tcat" colspan="8" style="smalltext">
<div class="smalltext"><em>You can have up to 3 files in an upload - file size is max 2mb, accepted formats are zip and rar. Please do not upload double rars or double files - server storage space is limited. You can choose to upload a file from your computer or from an url; uploading from the url is not a hotlink - it is uploaded via a file check program to the server. Its handiest for pictures in the finds area..... If you get an <strong>attachment error</strong> please check that you have correct FILE TYPE and FILE SIZE. If you have a larger file that you wish to upload please contact LeeFish via PM.</em></div>
</td>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>File 1: | Required File</div></td>
<td class="trow1" width="50%"><div>File 2: | Optional file</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['fupload']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['fupload2']}</div></td>
</tr>
<tr></tr>
<tr></tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>File 3: | Optional file</div></td>
<td class="trow1" width="50%"><div></div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['fupload4']}</div></td>
<td class="trow1" width="50%"><div></div></td>
</tr>
</tbody>
<tbody>
<tr>
<td class="trow1" colspan="2">
Some handy tips for uploading: once you have added all the pictures and files hit post preview; you can then see a small thumb of the pictures you have uploaded and a preview of the post. Like many forums we have bb code so you can make text bold, coloured, big small etc. I usually have one picture in the post preview, then a little preamble of text and then one picture in the post body (you can have more - all four if you wish) followed by information about the item - poly count, recolourable channels, price etc. Its up to you how you do it though - its <em>YOUR</em> upload
</td><br /></br />
</tr>
</table>
<br/>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tbody>
<tr>
<td class="thead" colspan="2">
</tr>
<if $GLOBALS['mybb']->user['usergroup'] == 4 || $GLOBALS['mybb']->user['usergroup'] == 8 then>{$tfinputrow['csbscr']}</if>
{$GLOBALS['threadfields']['pfpic']['value']}
{$GLOBALS['threadfields']['pfapic1']['value']}
{$GLOBALS['threadfields']['pfapic2']['value']}
{$GLOBALS['threadfields']['pfapic3']['value']}
{$tfinputrow['featureportal']}
{$tfinputrow['xtdispportal']}
{$tfinputrow['xtnewsbar']}
{$tfinputrow['xtnewsbar_class']}
{$tfinputrow['xtnewsbar_prefix']}
<tr>
<td class="trow1" width="20%">
</td>
<td class="trow1"width="80%">
</td>
<tr>
<td class="trow1" colspan="6" style="vertical-align: top">
<strong>Game Icon:</strong>
<br/>
<span class="smalltext">
<label>
<input type="radio" class="radio" name="icon" value="-1" checked="checked"/>
no icon
</label>
</span>
<label>
<input type="radio" name="icon" value="21"/>
<img src="images/icons/sims2icon.png" alt="sims2"/>
</label>
<label>
<input type="radio" name="icon" value="22"/>
<img src="images/icons/sims3icon.png" alt="sims2"/>
</label>
</td>
</tr>
{$codebuttons}
<tr>
<td class="trow2" valign="top"><strong>Your Upload Text</strong>{$smilieinserter}</td>
<td class="trow2">
<textarea name="message" id="message" rows="20" cols="80" tabindex="2">{$message}</textarea>
{$multiquote_external}
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
<td class="trow1"><span class="smalltext">
{$disablesmilies}</span></td>
</tr>
{$modoptions}
{$subscriptionmethod}
</tbody>
{$captcha}
</table>
<br />
<div align="center"><input type="submit" class="button" name="submit" value="{$lang->update_post}" tabindex="3" /> <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="4" /></div>
<input type="hidden" name="action" value="do_editpost" />
<input type="hidden" name="posthash" value="{$posthash}" />
<input type="hidden" name="attachmentaid" value="" />
<input type="hidden" name="attachmentact" value="" />
</form>
<br />
<form action="editpost.php" method="post" name="editpost">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="3"><strong>{$lang->delete_post}</strong></td>
</tr>
<tr>
<td class="trow1" style="white-space: nowrap"><input type="checkbox" class="checkbox" name="delete" value="1" tabindex="9" /> <strong>{$lang->delete_q}</strong></td>
<td class="trow1" width="100%">{$lang->delete_1}<br /><span class="smalltext">{$lang->delete_2}</span></td>
<td class="trow1"><input type="submit" class="button" name="submit" value="{$lang->delete_now}" tabindex="10" /></td>
</tr>
</table>
<input type="hidden" name="action" value="deletepost" />
<input type="hidden" name="pid" value="{$pid}" />
</form>
{$forumrules}
{$footer}
</body>
</html>
<html>
<head>
<title>{$lang->newthread_in}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
{$preview}
{$thread_errors}
{$attacherror}
<form action="newthread.php?fid={$fid}&processed=1" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tbody>
<tr><td class="thead" colspan="2"><strong>LeeFish Upload Wizard</strong></td></tr>
<tr>
<td class="trow_sep" colspan="2">
<div class="float_left" style="margin-left: 19px;">Item Name:</div>
<div class="float_left" style="margin-left: 9px;"><input type="text" class="textbox" name="subject" size="50" maxlength="85" value="{$subject}" tabindex="1" /></div>
</td>
</tr>
<tr><td class="tfoot" colspan="6"><strong>Required Information</strong></td></tr>
<tr>
<td class="tcat" colspan="6" style="smalltext">
<div class="smalltext"><em>Select the information for your upload from the dropdown boxes. You can select multiple EPs - hold CTRL and choose the EPs. Be careful which base game you choose....</em></div><br/>
</td>
</tr>
<tr>
<td class="trow2" colspan="6">
<div class="float_left">Game:</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['prefix']}</div>
<div class="float_left" style="margin-left: 19px;">EP(s) required:</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['dld_ep_prefix']} </div>
<div class="float_left" style="margin-left: 19px;">Category:</div>
<div class="float_left" style="margin-left: 9px;">{$tfinput['pfcat']}</div>
</td>
</tr>
</tbody>
<tbody>
<tr><td class="tfoot" colspan="8"><strong>Screenshots</strong></td></tr>
<tr>
<td class="tcat" colspan="8" style="smalltext">
<div class="smalltext"><em>You can have up to 4 screenshots - file size is max 200kb, max dimensions 1000*800. Accepted images formats are png, gif and jpg. You can choose to upload a file from your computer or from an url; uploading from the url is not a hotlink - it is uploaded via a file check program to the server. Its handiest for pictures in the finds area..... Images will only be shown full size in the light box - please do not use large images inline with the text as it will break the layouts - instead, use the preview post button and select the bbcoded large thumb to use in the main body. If you get an <span style="color:red;"><strong>attachment error</strong></span> please check that you have correct FILE TYPE, DIMENSIONS and FILE SIZE.</em></div>
</td>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>Screenshot 1: | This is your preview thumbnail</div></td>
<td class="trow1" width="50%"><div>Screenshot 2: | Optional picture</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['pfpic']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['pfapic1']}</div></td>
</tr>
<tr></tr>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>Screenshot 3: | Optional picture</div></td>
<td class="trow1" width="50%"><div>Screenshot 4: | Optional picture</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['pfapic2']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['pfapic3']}</div></td>
</tr>
</tbody>
<tbody>
<tr></tr>
<tr><td class="tfoot" colspan="8"><strong>File Upload</strong></td></tr>
<tr>
<td class="tcat" colspan="8" style="smalltext">
<div class="smalltext"><em>You can have up to 3 files in an upload - file size is max 2mb, accepted formats are zip and rar. Please do not upload double rars or double files - server storage space is limited. You can choose to upload a file from your computer or from an url; but uploading from an URL will not work as it is uploaded via a file check program to the server, and the program is paranoid. If you get an <span style="color:red;"><strong>attachment error</strong></span> please check that you have correct FILE TYPE and FILE SIZE and are not attempting to upload an URL type thing. If you have a larger file that you wish to upload please contact LeeFish via PM.</em></div>
</td>
</tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>File 1: | Required File</div></td>
<td class="trow1" width="50%"><div>File 2: | Optional file</div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['fupload']}</div></td>
<td class="trow1" width="50%"><div>{$tfinput['fupload2']}</div></td>
</tr>
<tr></tr>
<tr></tr>
<tr class="trow2">
<td class="trow1" width="50%"><div>File 3: | Optional file</div></td>
<td class="trow1" width="50%"><div></div></td>
</tr>
<tr></tr>
<tr class="trow1">
<td class="trow1" width="50%"><div>{$tfinput['fupload4']}</div></td>
<td class="trow1" width="50%"><div></div></td>
</tr>
</tbody>
<tbody>
<tr>
<td class="trow1" colspan="2">
Some handy tips for uploading: once you have added all the pictures and files hit post preview; you can then see a small thumb of the pictures you have uploaded and a preview of the post. Like many forums we have bb code so you can make text bold, coloured, big small etc. I usually have one picture in the post preview, then a little preamble of text and then one picture in the post body (you can have more - all four if you wish) followed by information about the item - poly count, recolourable channels, price etc. Its up to you how you do it though - its <em>YOUR</em> upload
</td><br /></br />
</tr>
</table>
<br/>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tbody>
<tr>
<td class="thead" colspan="2">
</tr>
<if $GLOBALS['mybb']->user['usergroup'] == 4 || $GLOBALS['mybb']->user['usergroup'] == 8 then>{$tfinputrow['csbscr']}</if>
{$GLOBALS['threadfields']['pfpic']['value']}
{$GLOBALS['threadfields']['pfapic1']['value']}
{$GLOBALS['threadfields']['pfapic2']['value']}
{$GLOBALS['threadfields']['pfapic3']['value']}
<tr>
<td class="trow1" width="20%">
</td>
<td class="trow1"width="80%">
</td>
<tr>
<td class="trow1" colspan="6" style="vertical-align: top">
<strong>Game Icon:</strong>
<br/>
<span class="smalltext">
<label>
<input type="radio" class="radio" name="icon" value="-1" checked="checked"/>
no icon
</label>
</span>
<label>
<input type="radio" name="icon" value="21"/>
<img src="images/icons/sims2icon.png" alt="sims2"/>
</label>
<label>
<input type="radio" name="icon" value="22"/>
<img src="images/icons/sims3icon.png" alt="sims2"/>
</label>
</td>
</tr>
{$codebuttons}
<tr>
<td class="trow2" valign="top"><strong>Your Upload Text</strong>{$smilieinserter}</td>
<td class="trow2">
<textarea name="message" id="message" rows="20" cols="80" tabindex="2">{$message}</textarea>
{$multiquote_external}
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
<td class="trow1"><span class="smalltext">
{$disablesmilies}</span></td>
</tr>
{$modoptions}
{$subscriptionmethod}
</tbody>
{$captcha}
</table>
<br />
<div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->post_thread}" tabindex="4" accesskey="s" /> <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="5" />{$savedraftbutton}</div>
<input type="hidden" name="action" value="do_newthread" />
<input type="hidden" name="posthash" value="{$posthash}" />
<input type="hidden" name="attachmentaid" value="" />
<input type="hidden" name="attachmentact" value="" />
<input type="hidden" name="quoted_ids" value="{$quoted_ids}" />
<input type="hidden" name="tid" value="{$tid}" />
{$editdraftpid}
</form>
{$forumrules}
{$footer}
</body>
</html>
<if THIS_SCRIPT == 'newthread.php' OR THIS_SCRIPT == 'editpost.php' then>
<tr><td class="trow2" style="smalltext" colspan="2"><em>Use the select button to select an URL , hit ctrl+C and copy into your post. Just one inline pic please - it keeps the post tidy</em></td></tr>
<tr>
<tr><td class="tcat" align="center" colspan="2"><strong>Image 1 Preview & URL</strong></td></tr>
<tr>
<td class="trow1" align="center">
<img src="{$GLOBALS['threadfields']['pfpic']['url']}/thumb160x120" alt="" title="" />
</td>
<td class="trow1" valign="top">
<div class="float_left" style="width: 50%;">
<strong>BBCODE - 640 x 480 Thumbnail</strong><br />
<input name="prev_pfpic_bbcode" type="text" size="40" value="[IMG]{$mybb->settings['bburl']}/{$GLOBALS['threadfields']['pfpic']['url']}/thumb640x480[/IMG]" readonly="readonly" />
<input type="button" value="Select" onClick="javascript:this.form.prev_pfpic_bbcode.focus();this.form.prev_pfpic_bbcode.select();">
</div>
<div class="float_left" style="width: 50%;">
<strong>Direct Link</strong><br />
<input name="prev_pfpic_dl" type="text" size="40" value="<func htmlspecialchars_uni><a href="{$mybb->settings['bburl']}/{$GLOBALS['threadfields']['pfpic']['url']}/thumb160x120">{$GLOBALS['threadfields']['pfpic']['filename']}</a></func>" readonly="readonly" />
<input type="button" value="Select" onClick="javascript:this.form.prev_pfpic_dl.focus();this.form.prev_pfpic_dl.select();">
</div>
<div class="float_left" style="width: 50%;">
<strong>HTML Code - 160 x 120 Thumbnail</strong><br />
<input name="prev_pfpic_html" type="text" size="40" value="<func htmlspecialchars_uni><img src="{$mybb->settings['bburl']}/{$GLOBALS['threadfields']['pfpic']['url']}/thumb160x120" alt="" title="" /></func>" readonly="readonly" />
<input type="button" value="Select" onClick="javascript:this.form.prev_pfpic_html.focus();this.form.prev_pfpic_html.select();">
</div>
<div class="float_left" style="width: 50%;">
<strong>Full Size Image URL</strong><br />
<input name="prev_pfpic_full" type="text" size="40" value="{$mybb->settings['bburl']}/{$GLOBALS['threadfields']['pfpic']['url']}" readonly="readonly" />
<input type="button" value="Select" onClick="javascript:this.form.prev_pfpic_full.focus();this.form.prev_pfpic_full.select();">
</div>
</td>
</tr>
</if>
I'm sorry to be a pain and I have no idea what can be causing this. The forum is set up with first post to show on every page and a fixed horizontal postbit.
EDIT >> and that was it - the first post being fixed to show on every page made this NOT work (based on the info on the github I turned the show first post option off and BOOM - it worked).
So, will there be a fix for this coming out? My layout looks stupid without the first post on every page option....