• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Thread_view problems...

Matthew2D

Well-known member
#1
Okay so today I made a template mod "search this thread in thread" (Havn't posted yet). I think it will work, except there is one problem. The thread_view looks messed up when I put the template there.

threadviewpic.png

footerview.png

Here is the template mod code


PHP:
<div class="pageNavLinkGroup">
<div class="linkGroup SelectionCountContainer">
 
<div class="Popup">
<a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" method="post" rel="Menu">Search this thread</a>
<div class="Menu JsOnly formPopup">
<form action="search/search" method="post">
<div class="primaryControls">
<input type="search" name="keywords" value="" class="textCtrl" placeholder="Search..." results="0" title="Enter your search and hit enter" />
</div>
 
<div class="secondaryControls">
 
<dl class="ctrlUnit submitUnit fullWidth">
<dt></dt>
<dd><input type="submit" value="Find Now" class="button primary"></dd>
</dl>
 
<a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" class="advSearchLink">Advanced search...</a>
</div>
 
<input type="hidden" name="type" value="post" />
<input type="hidden" name="child_nodes" value="1" />
<input type="hidden" name="threads[]" value="{$thread.thread_id}" />
<input type="hidden" name="_xfToken" value="$visitor.csrf_token_page" />
</form>
</div>
Also when I do search on it, I get this:

Security error occurred. Please press back, refresh the page, and try again.

Any suggestions?
 

Jake Bunce

XenForo moderator
Staff member
#2
Each menu (search and thread tools) needs to be in its own "Popup" div:

Code:
<div class="Popup">

</div>
If they share the same Popup div then both menus will open like in your picture.

And the form action should use xen:link syntax:

Code:
<form action="{xen:link 'search/search'}" method="post">
For the security error try adding the curlies:

Code:
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
 

Matthew2D

Well-known member
#3
Ok I followed your instructions and it didn't work. Except for the security thing. Then I copied my "Search This Forum in Threadlist" code and changed it for searching a thread. Then put it in the thread view and it doesn't show.

Code:
 <xen:if is="{$canSearch}">
            <div class="Popup">
                <a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" method="post" rel="Menu">{xen:phrase search_this_forum}</a>
 
                <xen:comment>
                <div class="Menu JsOnly">
                    <form action="{xen:link search/search}" method="post" class="xenForm">
                        <div class="primaryContent menuHeader">
                            <h3>{xen:phrase search_this_forum}</h3>
                        </div>
                        <dl class="ctrlUnit fullWidth">
                            <dt></dt>
                            <dd><input type="search" name="keywords" results="0" class="textCtrl" placeholder="{xen:phrase search}..." /></dd>
                        </dl>
                       
                        <dl class="ctrlUnit fullWidth submitUnit">
                            <dt></dt>
                            <dd><input type="submit" class="button" value="{xen:phrase find_now}" /></dd>
                        </dl>
                        <a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" class="linkButton">{xen:phrase advanced_search}</a>
 
                        <input type="hidden" name="type" value="post" />
                        <input type="hidden" name="child_nodes" value="1" />
                        <input type="hidden" name="nodes[]" value="{$thread.thread_id}" />
                        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                    </form>
                </div>
                </xen:comment>
 
                <div class="Menu JsOnly formPopup">
                    <form action="{xen:link search/search}" method="post">
                        <div class="primaryControls">
                            <input type="search" name="keywords" value="" class="textCtrl" placeholder="{xen:phrase search}..." results="0" title="{xen:phrase enter_your_search_and_hit_enter}" />
                        </div>
 
                       
   
                            <dl class="ctrlUnit submitUnit fullWidth">
                                <dt></dt>
                                <dd><input type="submit" value="{xen:phrase find_now}" class="button primary"></dd>
                            </dl>
 
                            <a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" class="advSearchLink">{xen:phrase advanced_search}...</a>
                        </div>
 
                        <input type="hidden" name="type" value="post" />
                        <input type="hidden" name="child_nodes" value="1" />
                        <input type="hidden" name="nodes[]" value="{$thread.thread_id}" />
                        <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
                    </form>
                </div>
</xen:if>
 

Jake Bunce

XenForo moderator
Staff member
#5
Here is your code, cleaned up and working:

Code:
<div class="pageNavLinkGroup">
	<div class="linkGroup SelectionCountContainer">
		<xen:if hascontent="true">
			<div class="Popup">
				<a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" method="post" rel="Menu">Search this thread</a>
				<div class="Menu JsOnly formPopup">
					<form action="{xen:link 'search/search'}" method="post">

					<div class="primaryControls">
						<input type="search" name="keywords" value="" class="textCtrl" placeholder="Search..." results="0" title="Enter your search and hit enter" />
					</div>
 
					<div class="secondaryControls">
						<dl class="ctrlUnit submitUnit fullWidth">
						<dt></dt>
						<dd><input type="submit" value="Find Now" class="button primary"></dd>
						</dl>

						<a href="{xen:link search, '', 'type=post', 'thread_id={$thread.thread_id}'}" class="advSearchLink">Advanced search...</a>
					</div>

					<input type="hidden" name="type" value="post" />
					<input type="hidden" name="type[post][thread_id]" value="{$thread.thread_id}" />
					<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />

					</form>
				</div>
			</div>

			<div class="Popup">

				<a rel="Menu">{xen:phrase thread_tools}</a>
				<div class="Menu">
					<div class="primaryContent menuHeader"><h3>{xen:phrase thread_tools}</h3></div>
					<ul class="secondaryContent blockLinksList">
						<xen:contentcheck>
							<xen:if is="{$canEditThread}">
								<li><a href="{xen:link 'threads/edit', $thread}" class="OverlayTrigger">{xen:phrase edit_thread}</a></li>
							</xen:if>
							<xen:if is="{$canDeleteThread}">
								<li><a href="{xen:link 'threads/delete', $thread}" class="OverlayTrigger">{xen:phrase delete_thread}</a></li>
							</xen:if>
							<xen:if is="{$canMoveThread}">
								<li><a href="{xen:link 'threads/move', $thread}" class="OverlayTrigger">{xen:phrase move_thread}</a></li>
							</xen:if>
							<xen:if is="{$deletedPosts}">
								<li><a href="{xen:link threads/show-posts, $thread, 'page={$page}'}" class="MessageLoader" data-messageSelector="#messageList .message.deleted.placeholder">{xen:phrase show_deleted_posts}</a></li>
							</xen:if>
						</xen:contentcheck>
					</ul>
					<xen:if hascontent="true">
					<form action="{xen:link threads/quick-update, $thread}" method="post" class="AutoValidator">
						<ul class="secondaryContent blockLinksList checkboxColumns">
						<xen:contentcheck>
							<xen:if is="{$canLockUnlockThread}">
							<li><label><input type="checkbox" name="discussion_open" value="1" class="SubmitOnChange" {xen:checked $thread.discussion_open} />
								{xen:phrase open_thread}</label>
								<input type="hidden" name="set[discussion_open]" value="1" /></li></xen:if>
							<xen:if is="{$canStickUnstickThread}"> 
							<li><label><input type="checkbox" name="sticky" value="1" class="SubmitOnChange" {xen:checked $thread.sticky} />
								{xen:phrase sticky}</label>
								<input type="hidden" name="set[sticky]" value="1" /></li></xen:if>
						</xen:contentcheck>
						</ul>
						<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
					</form>
					</xen:if>
					<xen:if is="{$thread.canInlineMod}">
					<form action="{xen:link inline-mod/thread/switch}" method="post" class="InlineModForm sectionFooter" id="threadViewThreadCheck"
						data-cookieName="threads">
						<label><input type="checkbox" name="threads[]" value="{$thread.thread_id}" class="InlineModCheck" /> {xen:phrase select_for_thread_moderation}</label>
						<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
					</form>
					</xen:if>
				</div>
			</div>
		</xen:if>
		<xen:if is="{$canWatchThread}">
			<a href="{xen:link 'threads/watch-confirm', $thread}" class="OverlayTrigger" data-cacheOverlay="false">{xen:if $thread.thread_is_watched, '{xen:phrase unwatch_thread}', '{xen:phrase watch_thread}'}</a>
		</xen:if>
	</div>

	<xen:pagenav link="threads" linkdata="{$thread}"
		page="{$page}" perpage="{$postsPerPage}" total="{$totalPosts}"
		unreadlink="{$unreadLink}" />
</div>
 

russoroni

Active member
#8
@Jake Bunce do you think you could take a crack at this? I'm having a problem getting this search form to work. I'm not getting a security error anymore now that I put in
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" /> but its not redirecting to where it's supposed to. Its going to www.blah.org/inline-mod/post/switch

Code:
<form method="post" action="http://www.mytopo.com/search.cfm?pid=your_partner_id">
<table border="0" cellpadding="1" cellspacing="0" bgcolor="#000000"><TR><TD>
<table border="0" cellpadding="2" cellspacing="0" align="center" bgcolor="#FFFFFF">
<tr border="0">
<td bgcolor="#FFFFFF" align="left" valign="middle"><font face="verdana,arial,helvetica" size="-2"><b>Search for</b></font>
<input type="text" name="feature" width=15 size=15 value="Placename">
<font face="verdana,arial,helvetica" size="-2"> 
in <select name="state">
<option value="AL" selected>Alabama<option value="AZ">Arizona
<option value="AR">Arkansas<option value="CA">California
<option value="CO">Colorado<option value="CT">Connecticut
<option value="DE">Delaware<option value="DC">District of Columbia
<option value="FL">Florida<option value="GA">Georgia
<option value="ID">Idaho<option value="IL">Illinois
<option value="II">Indiana<option value="IA">Iowa
<option value="KS">Kansas<option value="KY">Kentucky
<option value="LA">Louisiana<option value="ME">Maine
<option value="MD">Maryland<option value="MA">Massachusetts
<option value="MI">Michigan<option value="MN">Minnesota
<option value="MS">Mississippi<option value="MO">Missouri
<option value="MT">Montana<option value="NE">Nebraska
<option value="NV">Nevada<option value="NH">New Hampshire
<option value="NJ">New Jersey<option value="NM">New Mexico
<option value="NY">New York<option value="NC">North Carolina
<option value="ND">North Dakota<option value="OH">Ohio
<option value="OK">Oklahoma<option value="OE">Oregon
<option value="PA">Pennsylvania<option value="RI">Rhode Island
<option value="SC">South Carolina<option value="SD">South Dakota
<option value="TN">Tennessee<option value="TX">Texas
<option value="UT">Utah<option value="VT">Vermont
<option value="VA">Virginia<option value="WA">Washington
<option value="WV">West Virginia<option value="WI">Wisconsin
<option value="WY">Wyoming</option>
</select>
</font>
<input type="submit" border=0 value="Go!" name="Search">
</td>
<tr>
<td valign="top" align="center" bgcolor="#000000">
<img src="search-image.gif" width=175 height=35>
</td>
</tr>
</table></td></tr></table>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>