058-007 - FIXED - Mark Post As Read Error


Subject: 058-007 - FIXED - Mark Post As Read Error
Hi,

i tried to fix this with that tpl file.

but the only problem is with the checkbox, that doesn´t apear if i add the switch in the tpl file.

Code: (search_results_topics.tpl) [Download] [Hide] [Select]
<script language="Javascript" type="text/javascript">
function select_switch(status)
{
for (i = 0; i < document.post.length; i++)
{
document.post.elements[i].checked = status;
}
}
</script>
<div class="forumline nav-div">
<p class="nav-header">
<a href="{U_PORTAL}" class="nav">{L_HOME}</a>{NAV_SEP}<a href="{U_INDEX}">{L_INDEX}</a>{NAV_SEP}<a href="{U_SEARCH}">{L_SEARCH}</a>{NAV_SEP}<a href="#" class="nav-current">{L_SEARCH_MATCHES}</a>
</p>
<div class="nav-links">
<div class="nav-links-left">
{CURRENT_TIME}
</div>
&nbsp;
</div>
</div>
<form action="{S_POST_ACTION}" method="post" name="post">
<table width="100%" cellspacing="0" class="forumline">
<tr>
<td colspan="8" class="row-header"><span>{L_SEARCH_MATCHES}</span></td>
</tr>
<tr>
<th width="18">&nbsp;</th>
<th>{L_FORUM}</th>
<th>{L_TOPICS}</th>
<th>{L_REPLIES}</th>
<th>{L_AUTHOR}</th>
<th>{L_VIEWS}</th>
<th>{L_LASTPOST}</th>
<!-- BEGIN switch_upi2db_on -->
<th>{L_MAR}</th>
<!-- END switch_upi2db_on -->
</tr>
<!-- BEGIN searchresults -->
<tr>
<td class="row3 row-center">
{searchresults.U_MARK_ALWAYS_READ}
<!-- <img src="{searchresults.TOPIC_FOLDER_IMG}" alt="{searchresults.L_TOPIC_FOLDER_ALT}" title="{searchresults.L_TOPIC_FOLDER_ALT}" /> -->
</td>
<td class="row1h row-forum" onclick="window.location.href='{searchresults.U_VIEW_FORUM}'"><span class="forumlink"><a href="{searchresults.U_VIEW_FORUM}" class="forumlink">{searchresults.FORUM_NAME}</a></span></td>
<td class="row1h row-forum" onclick="window.location.href='{searchresults.U_VIEW_TOPIC}'"><span class="topiclink">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><span class="gotopage">{searchresults.GOTO_PAGE}</span></td>
<td class="row1 row-center-small">{searchresults.REPLIES}</td>
<td class="row2 row-center-small">{searchresults.TOPIC_AUTHOR}</td>
<td class="row1 row-center-small">{searchresults.VIEWS}</td>
<td class="row2 row-center-small">{searchresults.LAST_POST_TIME}<br />{searchresults.LAST_POST_AUTHOR} {searchresults.LAST_POST_IMG}</span></td>
<!-- BEGIN switch_upi2db_on -->
<td class="row1 row-center-small" nowrap="nowrap"><input type="checkbox" name="mar_topic_id[]" value="{searchresults.TOPIC_ID}" {searchresults.NO_AGM}></td>
<!-- END switch_upi2db_on -->
</tr>
<!-- END searchresults -->
<tr>
<td class="spaceRow" colspan="8"><img src="templates/ca_aphrodite/images/{TPL_COLOR}/spacer.gif" width="1" height="3" alt="" /></td>
</tr>
<tr>
<td class="catBottom" colspan="8">
<!-- BEGIN switch_upi2db_on -->
<input type="submit" class="mainoption" value="{L_SUBMIT_MARK_READ}" />
<input name="mar" type="hidden" value="1" />
<!-- END switch_upi2db_on -->
</td>
</tr>
</table>
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
<tr>
<td valign="middle" align="right"><a href="javascript:select_switch(true);" class="gensmall">{L_MARK_ALL}</a>&nbsp;|&nbsp;<a href="javascript:select_switch(false);" class="gensmall">{L_UNMARK_ALL}</a></td>
</tr>
</table>
</form>

<table width="100%" cellspacing="0" class="empty-table">
<tr>
<td align="left" valign="top">{PAGE_NUMBER}</td>
<td align="right" valign="top" nowrap="nowrap"><span class="pagination">{PAGINATION}</span><br /><span class="gensmall">{S_TIMEZONE}</span></td>
</tr>
</table>

<div align="right">{JUMPBOX}</div>


i thought this is an easy fix, but it seems that i missed something :cry:

Subject: Re: Mark Post As Read Error
He he he... adding a switch sometimes it's not so easy as you may think! :wink:

You should consider that nested switches must be defined as nested... and recall them as nested...

Example:

  • You have a cycle of switches... for example POSTROW
  • If you want to add a switch in POSTROW, you have to define it as POSTROW.SWITCH
  • Then you have to recall it as POSTROW.SWITCH even in the template
  • All the vars must have the nested prefix: POSTROW.SWITCH.VAR


I hope that it helps you... :wink:

Try again KugeL, your training is going on... :mrb:

Subject: Re: Mark Post As Read Error
ok i got it working :D

use the tpl file in my first post. apply this

OPEN search.php
FIND
Code: [Download] [Hide] [Select]
//<!-- BEGIN Unread Post Information to Database Mod -->
'U_MARK_ALWAYS_READ' => $mark_always_read,
//<!-- END Unread Post Information to Database Mod -->
'U_VIEW_FORUM' => $forum_url,
'U_VIEW_TOPIC' => $topic_url)
);

AFTER ADD
Code: [Download] [Hide] [Select]
//<!-- BEGIN Unread Post Information to Database Mod -->
if( $userdata['upi2db_access'] )
{
$template->assign_block_vars('searchresults.switch_upi2db_on', array());
}
//<!-- END Unread Post Information to Database Mod -->


not really sure if there is an easier way. but it works =)

Subject: Re: Mark Post As Read Error
Can you post a zip file with the modified files please?

Thanks! :wink:

Subject: Re: Mark Post As Read Error
here we go ;-)


mark_post_as_read_fix.rar
Description:
Download
Filename: mark_post_as_read_fix.rar
Filesize: 15.5 KB
Downloaded: 424 Time(s)


Page 1 of 1


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 0.2128s (PHP: 12% SQL: 88%)
SQL queries: 15 - Debug Off - GZIP Enabled