10-02-2010, 06:44 AM
10-02-2010, 06:54 AM
(10-02-2010 06:43 AM)RateU Wrote: [ -> ]EDIT:
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.
Example:
HTML Code
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both; border-bottom-width: 0;"> <tr> <td class="thead" colspan="2"><strong>{$lang->post_preview}</strong></td> </tr> </table> {$postbit} <br /> <form> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both; border-bottom-width: 0;"> <tr><td class="thead" colspan="2"><strong>Images Preview</strong></td></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 - 160 x 120 Thumbnail</strong> <input name="prev_img1_bbcode" type="text" size="40" value="[IMG]{$mybb->settings['bburl']}/{$GLOBALS['threadfields']['pfpic']['url']}/thumb160x120[/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> <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> <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> </table> </form> <br />
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:
HTML Code
<a href="{URL}" rel="lightbox[find]"><img src="{URL}/thumb160x120" alt="{$thread['subject']} Screenshot" title="{$GLOBALS['threadfields']['pfpicdesc']}" style="border: 1px solid #C1C1C1; padding: 3px; margin: 3px;" /></a>
Sorry, Lee. I've edited my post too.
EDIT: Don't forget to remove the {$GLOBALS['threadfields']['pfpic']['value']} variable from your newthread template.
Other method:
Just change the {$GLOBALS['threadfields']['pfpic']['value']} variable in postbit to:
HTML Code
|
10-02-2010, 07:11 AM
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.
10-02-2010, 07:27 AM
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.
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.
10-02-2010, 07:56 AM
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.
10-03-2010, 07:18 AM
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
10-26-2010, 08:10 PM
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).
Hope that helps.
Probably document.getElementById() is more reliable (with changes in ID).
Hope that helps.
10-27-2010, 05:26 AM
Do you mean like this, Yumi?
Display Format:
Display Format:
HTML Code
|
10-27-2010, 09:16 AM
Yeah, I think so.
But that's weird too, this.form should be valid... http://www.w3schools.com/jsref/prop_button_form.asp
Maybe I should try looking into it more when I get home.
But that's weird too, this.form should be valid... http://www.w3schools.com/jsref/prop_button_form.asp
Maybe I should try looking into it more when I get home.
10-29-2010, 02:15 AM
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)
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.
These are my templates:
prefix_editpost_first
(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.
These are my templates:
prefix_editpost_first
Code:
|
prefix_newthread
Code:
|
Display Format
Code:
|
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....