News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Related Topics

Started by niko, September 14, 2005, 11:50:29 AM

Previous topic - Next topic

carlatf

#40
Hi People! :)
this mod is great!.
Howewer I'm stuck in the installation process.
I got this error:

   Executar Modificación     ./Sources/Display.php     Éxito
2.    Executar Modificación    ./Themes/default/Display.template.php    Prueba fallida (Failed).

So I started to do it manually to see what was wrong, the problem is here:

display.template.php

   <operation>
         <search position="after"><![CDATA[
      currentSwap = !currentSwap;
   }';]]></search>

      <add><![CDATA[   echo '
   var currentSwapRel = trueetc..

I have no lines containing "currentSwap = !currentSwap;"

I'm running SMF 1.1 RC2 and a very modified version of the SAF theme.
I haven't these lines because I erased them following the instructions to update the theme from rc1 to rc2. (http://www.simplemachines.org/community/index.php?topic=64744.0).


What I can do to make this work? I have no currentswap anywhere in the Display template.

Best,
Carla


kezayah

I'm very interesting by this mod too !!!  :P
Like Carla, I have the same problem  :'(
This mod must to generate a lot of requiest ??  :-\

kezayah

Can someone help me ??  ??? ??? ???

kezayah




kezayah

Yeaaaaaaaaaah !!!
What is the code in display.template.php pleaaaase ??  :P

Senkusha

#47
I've succssfully gotten this to work on my RC2 board.  I'll post the modified package in a moment.  Oh, beware, if it's already not stated somewhere, you'll have to modify your database.  Specifically, the messages table.  You need to create a new Index field.  I called mine Score.  You'll need to make it a FullText index field using the subject, body columns.  I'll also provide a screen shot of my NaviCat (sql program) display for the changes.

Well, since I can't post attachments here, I'll link to my site.
Related Topics RC 2 Mod

Hopefully, this will work for you.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Søren Bjerg

I get the following "Template Parse Error!" after installing the mod in the version you posted, Senkusha:

QuoteTemplate Parse Error!
There was a problem loading the /Themes/default/Display.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
parse error, unexpected T_STRING, expecting ',' or ';'

Tried finding out what was wrong by myself, but got confused by the switching of using " or ' to echo HTML :/.
RUNE HORDES dot INFO - SMF 1.1.10 w/ Custom Profile Mod... and various permissions hooks and template changes (new topic form).

ArkServer

I installed the rc2 mod and it works fine :) thanks dude!

kezayah

there is an error in your code :
The really code of install1-1.xml is :

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">

<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">

<id>Niko:RelatedTopics</id>

<version>1.0.1</version>

<file name="$sourcedir/Display.php">
      <operation>
         <search position="before"><![CDATA[$topicinfo = mysql_fetch_assoc($request);]]></search>

         <add><![CDATA[$terms = explode(" ",$topicinfo['subject']);

   foreach($terms As $term){
      $term = str_replace(array(":","-","+","~"),"",$term); // These are reversed in mysql need to remove to work correctly
      if(strlen($term) > 3) $mssub .= trim($term)." ";
   }

   $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
   $context['icon_sources'] = array();
   foreach ($stable_icons as $icon)
   $context['icon_sources'][$icon] = 'images_url';

   $mssub = trim(mysql_real_escape_string($mssub));
   //fatal_error($mssub);
   $related = db_query("SELECT *, MATCH (ms.subject,ms.body) AGAINST ('{$mssub}') As Score  FROM {$db_prefix}messages As ms WHERE MATCH (ms.subject,ms.body) AGAINST ('{$mssub}') ORDER BY Score DESC LIMIT 0,10",__FILE__,__LINE__); //
   $context['related_topics'] = array();

   $tids = array(
   $topic => true,
   );
   while($relTopic = mysql_fetch_array($related)){
      $x = $relTopic;
      if(!isset($tids[$relTopic['ID_TOPIC']])){
         $tids[$relTopic['ID_TOPIC']] = true; // Prevent same appearing many times
         $tox = db_query("SELECT * FROM {$db_prefix}topics As t,{$db_prefix}messages As ml WHERE t.ID_TOPIC='{$relTopic['ID_TOPIC']}' AND ml.ID_MSG = t.ID_LAST_MSG LIMIT 0,1",__FILE__,__LINE__); //
         $tox2 = db_query("SELECT * FROM {$db_prefix}topics As t,{$db_prefix}messages As ml WHERE t.ID_TOPIC='{$relTopic['ID_TOPIC']}' AND ml.ID_MSG = t.ID_FIRST_MSG LIMIT 0,1",__FILE__,__LINE__); //
                  
         $x['more'] = mysql_fetch_array($tox);
         $x['first'] = mysql_fetch_array($tox2);
         mysql_free_result($tox);
         mysql_free_result($tox2);

         $x += array('icon_url' => $settings[ $context['icon_sources'][ $x['icon'] ]] . '/post/' . $x['icon'] . '.gif');
         $x['more']['time'] = timeformat($x['more']['posterTime'],true);
         loadMemberData( array($x['more']['ID_MEMBER'], $x['first']['ID_MEMBER']) );
         global $memberContext;

            loadMemberContext( $x['more']['ID_MEMBER'] );
            if(isset($memberContext[ $x['more']['ID_MEMBER'] ]))
            $x['more']['member'] = $memberContext[ $x['more']['ID_MEMBER'] ];
            else
            $x['more']['member']['link'] = $x['more']['posterName'];
         

            loadMemberContext( $x['first']['ID_MEMBER'] );
            if(isset($memberContext[ $x['first']['ID_MEMBER'] ]))
            $x['first']['member'] = $memberContext[ $x['first']['ID_MEMBER'] ];
            else
            $x['first']['member']['link'] = $x['first']['posterName'];
         
         $x += array(
         'is_sticky' => $x['more']['isSticky'],
         'is_locked' => $x['more']['locked'],
         'is_poll' =>  $x['more']['ID_POLL'] == 0 ? 0 : 1 );
         determineTopicClass($x);
         $context['related_topics'][] = $x;
         unset($x);
      }
   }
   mysql_free_result($related);]]>
   </add>
      </operation>
</file>

<file name="Themes/default/Display.template.php">
      <operation>
         <search position="before"><![CDATA[   echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0">
   <tr>
      <td class="middletext">', $txt[139], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#top"><b>' . $txt['topbottom4'] . '</b></a>' : '', '</td>
      <td align="right" style="padding-right: 1ex;">
         <table cellpadding="0" cellspacing="0">
            <tr>
               ', template_button_strip($normal_buttons, 'top', true), '
            </tr>
         </table>
      </td>
   </tr>
</table>';

]]></search>
         <add><![CDATA[   if(is_array($context['related_topics']) && count($context['related_topics']) > 0)
   $showRelated = true;

   if($showRelated){
      echo '<br />';
      echo '
         <table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
                     <tr class="catbg"><td colspan="7"><img src="', $settings['images_url'], '/collapse.gif" alt="+" border="0" id="related_img" onclick="swapRelated();"/> <a href="javascript:swapRelated();"> Related Topics</a></td></tr>
            ';

      $i = 0;
      echo '<tr id="related"><td colspan="7" class="windowbg2"><table  border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor"><tr class="titlebg"><td width="9%" colspan="2"></td>
               <td>', $txt[70], '</a></td>
               <td width="14%"> ', $txt[109], '
               <td width="4%" align="center">', $txt[110], '</a></td>
               <td width="4%" align="center">', $txt[301], '</a></td>
               <td width="20%">', $txt[111], '</a></td>';
      echo '</tr>';
      foreach($context['related_topics'] as $tmp){
         //   echo "<tr><td>".print_r($tmp,true)."</td></tr>";
         $color[0] = "windowbg";
         $color[1] = "windowbg2";
         
         
         echo "<tr>
         <td valign=\"middle\" align=\"center\" width=\"4%\" class=\"{$color[$i % 2]}\">",'<img src="', $settings['images_url'], '/topic/', $tmp['class'], '.gif" alt="" /></td>',"
         <td valign=\"middle\" align=\"center\" width=\"4%\" class=\"{$color[$i++ % 2]}\"><img src='",$tmp['icon_url'],"' alt=''></td>
         <td class=\"{$color[$i % 2]}\"><a href=\"$scripturl?topic={$tmp['ID_TOPIC']}.0\">".$tmp['first']['subject']."</a></td>
         <td class=\"{$color[$i++ % 2]}\">", $tmp['first']['member']['link'], "</td>
         <td class=\"{$color[$i % 2]}\">",$tmp['more']['numReplies'],"</td>
         <td class=\"{$color[$i++ % 2]}\">",$tmp['more']['numViews'],"</td>
         <td class=\"{$color[$i++ % 2]}\">
                  <a href=",'"', "$scripturl?topic={$tmp['ID_TOPIC']}.msg{$tmp['more']['ID_MSG']}", '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>
                  <span class="smalltext">
                     ', $tmp['more']['time'], '<br />
                     ', $txt[525], ' ', $tmp['more']['member']['link'], "
                  </span>
         </td>
         </tr>";
         //$i++;
      }
      echo '</table></td></tr>';
      echo '</table>';
   }]]></add>
      </operation>
</file>



</modification>

Senkusha

Hmmm, I'll take another look at the code, and try to install fresh on another test board.  In my defense, all I did was tweaked the version for SMF, and changed the search string to match the current template.  When I did both installs on my own, production and test boards, they both worked flawlessly.

Sorry about this.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

ArkServer

is it possible to filter out the recycled topics?

Senkusha

I'm not sure, since I didn't write this, and I don't know the MATCH...AGAINST syntax all that well.  It could be possible, using a WHERE...AND statement to filter out those boards, however, I'm not sure how SMF determines if a board is a Recycling Board or not.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

fiver

I installed the mod on 1.1rc2 and got this:

Can't find FULLTEXT index matching the column list
File: /.............../Sources/Display.php
Line: 164

So I uninstalled the mod; changed the 'after' to 'before' as suggested by kezayah; reinstalled the mod and it works!

Thanks Senkusha and kezayah! :D

Senkusha

I got that error when I first installed it as well.  I modified my database to include a new index for the messages table as type FULLTEXT (per the MySQL site).
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

fiver

#56
Hi guys,

Please take a look at your Forum Error Log and see whether you have the same error messages as these...

8: Undefined index: is_hot
File: /.............../Sources/Subs.php
Line: 2981

8: Undefined index: is_very_hot
File: /.............../Sources/Subs.php
Line: 2979

8: Undefined variable: mssub
File: /.............../Sources/Display.php
Line: 154

8: Undefined variable: showRelated
File: /.........../Themes/default/languages/Ignore.english.php (eval?)
Line: 625

Do you have these error messages? Any solution please?

;)

fiver

#57
Just uninstalled and there are 2 uninstallation errors:

Quotehttp://............./index.php?action=packages;sa=uninstall;package=Related_Topics2.zip

512: parseModification(): The filename 'Themes/default/Display.template.php' is not a full path!
File: /...................../Sources/Subs-Package.php
Line: 1329

Quotehttp://............../index.php?action=packages;sa=uninstall2;package=Related_Topics2.zip

512: parseModification(): The filename 'Themes/default/Display.template.php' is not a full path!
File: /......................./Sources/Subs-Package.php
Line: 1329

... while the four errors in my last post no longer occur.


Senkusha

#58
Yes, I see these errors as well.  They are being caused by the  determineTopicClass($var) function being called. 

I have fixed this error and have adjusted my MOD modification package accordingly.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

kezayah

Quote from: Senkusha on April 18, 2006, 03:33:30 PM
I have fixed this error and have adjusted my MOD modification package accordingly.
QuotePlease wait while we find your download.....
Table 'mm_anime.smf_file_uploads' doesn't exist
:(

Advertisement: