News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

Bookmarks

Started by Matthew K., July 16, 2007, 01:07:24 PM

Previous topic - Next topic

LinK187

Is it possible someone could answer my previous post? Just scroll up.

thx  8)

Antechinus

Quote from: Charles Hill on March 29, 2008, 12:09:27 PM
I really like this mod.  I added something cool to it.  Perhaps you would like to add it as well.  Well here's a description of what I did...

I wanted to allow users to access their bookmarks quickly through a pop-out drop-down menu by simply hovering over the My Bookmarks link in the main menu.  I modified the main menu in my forum to do this a while ago, so it wasn't too difficult to add it for My Bookmarks as well.  When a user hovers over the My Bookmarks a drop-down menu appears that says 'None' if they have no bookmarks and displays each of their bookmarks as a list if they do have at least one bookmark.  I'll add the code here after I eat some lunch.

You've been eating lunch for  three months? That's some lunch you have there.
How about the code then?  :P

eforhan

This is the first time I've tried installing this on my board.  I'm getting a fatal error when navigating to a message. In fact, it only shows the template parse error, and nothing else.

SMF 1.15
Default theme
It says it successfully installs.

Error (it highlights LN 168):
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: syntax error, unexpected T_DOUBLE_ARROW in .../Themes/default/Display.template.php on line 168

159: </li>';
160: echo '
161: </ul>
162: </td>
163: </tr>
164: </table>';
165: }
166:
167: // Build the normal button array.

168: 'bookmark' => array('text' => 'bookmark_add', 'test' => 'can_reply', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic']),

169: $normal_buttons = array(
170: 'reply' => array('test' => 'can_reply', 'text' => 146, 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies']),
171: 'notify' => array('test' => 'can_mark_notify', 'text' => 125, 'image' => 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']),
172: 'custom' => array(),



My installed add-ons:
1.     FlashChat Integration     1.0     [ Uninstall ]
2.    Futurama Avatars    1.0    [ Uninstall ]
3.    Spoiler Show And Hide    1.0.3    [ Uninstall ]
4.    BoardHover Mod    1.2    [ Uninstall ]
5.    ColorizePost    1.2    [ Uninstall ]
6.    Topic Member Post Count    1.1.5    [ Uninstall ]
7.    Enhanced Quick Reply Box 2.0.2    2.0.2    [ Uninstall ]
8.    Google Member Map    0.1    [ Uninstall ]
9.    Attachments Positioning    1.2    [ Uninstall ]
10.    SMF 1.0.13 / 1.1.5 / 2.0 b3.1 Update    1.0    [ Uninstall ]
11.    Auto Embed Video Clips    2.2

Angelotus

Hi,

I have to install the bookmarks database table manually.
What code to use in phpmyadmin??

Aaron

Quote from: eforhan on July 11, 2008, 08:18:37 PM
This is the first time I've tried installing this on my board.  I'm getting a fatal error when navigating to a message. In fact, it only shows the template parse error, and nothing else.

Replace:

    // Build the normal button array.

       'bookmark' => array('text' => 'bookmark_add', 'test' => 'can_reply', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic']),

    $normal_buttons = array(
       'reply' => array('test' => 'can_reply', 'text' => 146, 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies']),


With:

    // Build the normal button array.
    $normal_buttons = array(
       'reply' => array('test' => 'can_reply', 'text' => 146, 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies']),
       'bookmark' => array('text' => 'bookmark_add', 'test' => 'can_reply', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic']),


Quote from: Angelotus on July 12, 2008, 11:41:22 AM
I have to install the bookmarks database table manually.
What code to use in phpmyadmin??

That's been said at least ten times already. :P Anyway:

CREATE TABLE smf_bookmarks
(
   `ID_MEMBER` mediumint(8) unsigned NOT NULL,
   `ID_TOPIC` mediumint(8) unsigned NOT NULL,
   UNIQUE KEY `ID_MEMBER` (`ID_MEMBER`,`ID_TOPIC`)
);

Angelotus

Wow, that's fast! Thanks for you reply, that worked!

SunilDVR

Hi Aaron,

I don't know if you missed my reply on 29th June - you asked me to post the section of the code which was giving an error, and I did so here.

Any help appreciated!

Thanks

Sunil

Aaron

Quote from: SunilDVR on July 13, 2008, 10:32:52 AM
I don't know if you missed my reply on 29th June - you asked me to post the section of the code which was giving an error, and I did so here.

Sorry, yes, I must've missed that.

Find:

        if ($context['can_reply'])
                $buttonArray[] = '<a href="' . $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . '.' . $context['start'] . '.0;do=Bookmark' . $context['bookmark_message'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addbm1.gif" alt="' . $txt[Bookmark] . '" border="0" />' : $txt[Bookmark]) . '</a>';       


Replace with:

        if ($context['can_reply'])
                $buttonArray[] = '<a href="' . $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . '.' . $context['start'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addbm1.gif" alt="' . $txt['bookmark_add'] . '" border="0" />' : $txt['bookmark_add']) . '</a>';


That should work.

Angelotus

Quick Question.

I'd like to add a SSI feature to my frontpage (www.weeklyfun.nl) to show 5 favorite topics added by the logged in member.

In 1.1.5 I used this code:

// Show favorites.
function ssi_favorieten($output_method = 'echo')
{



global $ID_MEMBER, $scripturl, $db_prefix;
$request = db_query("SELECT t.ID_TOPIC, m.subject, mem.ID_MEMBER, mem.realName
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}bookmarks AS bm ON (bm.ID_TOPIC = t.ID_TOPIC AND bm.ID_MEMBER = $ID_MEMBER)
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
ORDER BY RAND()
LIMIT 5",__FILE__,__LINE__);
$topics = array();
while($row = mysql_fetch_assoc($request)) {
$topics[] = '<td valign="top" align="left"><div class="smalltext"><img src="http://www.nessekrekers.nl/favorieten.gif" border="0" alt="Mijn Favorieten">&nbsp;<a href="'.$scripturl.'?topic='.$row['ID_TOPIC'].'">'.$row['subject'].'</a></div></td><td valign="top" align="right"><div class="smalltext"><a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$row['realName'].'</a></div></td>';
}
mysql_free_result($request);
foreach($topics as $t)
echo '<tr onmouseover="this.style.backgroundColor=\'#efefef\';" onmouseout="this.style.backgroundColor=\'transparent\';">',$t,'</tr>';

}


And that worked fine. Now I use 2.0 and it doesn't work anymore.
What is wrong with this code?

Aaron

The database structure of SMF 2.0 differs from SMF 1.1, so you'd need to change the field names to reflect their SMF 2.0 equivalents. For example, 'realName' should be 'real_name' and 'ID_MEMBER' should be 'id_member'.

Angelotus

ok, that's it! Thanks!

cr34t1v3

Quote from: cr34t1v3 on July 06, 2008, 10:57:02 AM
Quote from: Aäron on July 04, 2008, 06:34:04 PM
Which version of PHP and MySQL power your server? You can find this information in Admin -> Support and Credits.

Forum version: SMF 1.1.5 (more detailed)
Current SMF version: SMF 1.1.5
PHP version: 5.2.5
MySQL version: 5.0.51a-community
Server version: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
GD version: bundled (2.0.34 compatible)

Hi Aaron, any idea on my case?
Notebook & Computer Online Store in Indonesia:
http://www.anugrahpratama.com
Computer & Notebook Forum in Indonesia:
http://forum.anugrahpratama.com
Computer & Laptop Review & News Blog:
http://blog.anugrahpratama.com

Angelotus

Quote from: Aäron on July 13, 2008, 06:03:23 PM
The database structure of SMF 2.0 differs from SMF 1.1, so you'd need to change the field names to reflect their SMF 2.0 equivalents. For example, 'realName' should be 'real_name' and 'ID_MEMBER' should be 'id_member'.

I have taken a look at the code and de db structure. The table bookmarks still works with ID_MEMBER instead of the 2.0 id_member, as same voor topics.

So I changed the code into:
// Show favorites.
function ssi_favorieten($output_method = 'echo')
{
global $id_member, $scripturl, $db_prefix;

$request = db_query("SELECT t.id_topic, m.subject, mem.id_member, mem.real_name
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}bookmarks AS bm ON (bm.ID_TOPIC = t.ID_TOPIC AND bm.ID_MEMBER = $ID_MEMBER)
INNER JOIN {$db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {$db_prefix}members AS mem ON (mem.id_member = m.id_member)
ORDER BY RAND()
LIMIT 5",__FILE__,__LINE__);
$topics = array();
while($row = mysql_fetch_assoc($request))
{
$topics[] = '<td valign="top" align="left"><div class="smalltext"><img src="http://www.nessekrekers.nl/favorieten.gif" border="0" alt="Mijn Favorieten">&nbsp;<a href="'.$scripturl.'?topic='.$row['ID_TOPIC'].'">'.$row['subject'].'</a></div></td><td valign="top" align="right"><div class="smalltext"><a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">'.$row['real_name'].'</a></div></td>';
}
mysql_free_result($request);
foreach($topics as $t)
echo '<tr onmouseover="this.style.backgroundColor=\'#efefef\';" onmouseout="this.style.backgroundColor=\'transparent\';">',$t,'</tr>';
}


I can't get it to work...help please..

Aaron

SMF 2.0 also doesn't have a db_query function anymore. You should use $smcFunc['db_query'] instead. Try something like this instead:


// Show favorites.
function ssi_favorieten($output_method = 'echo')
{
global $id_member, $scripturl, $db_prefix;

$request = $smcFunc['db_query']('', "SELECT t.id_topic, m.subject, mem.id_member, mem.real_name
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}bookmarks AS bm ON (bm.ID_TOPIC = t.id_topic AND bm.ID_MEMBER = {int:id_member})
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
ORDER BY RAND()
LIMIT 5", array('id_member' => $ID_MEMBER);
$topics = array();
while($row = mysql_fetch_assoc($request))
{
$topics[] = '<td valign="top" align="left"><div class="smalltext"><img src="http://www.nessekrekers.nl/favorieten.gif" border="0" alt="Mijn Favorieten">&nbsp;<a href="'.$scripturl.'?topic='.$row['ID_TOPIC'].'">'.$row['subject'].'</a></div></td><td valign="top" align="right"><div class="smalltext"><a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">'.$row['real_name'].'</a></div></td>';
}
mysql_free_result($request);
foreach($topics as $t)
echo '<tr onmouseover="this.style.backgroundColor=\'#efefef\';" onmouseout="this.style.backgroundColor=\'transparent\';">',$t,'</tr>';
}

Angelotus

Thanks for your help so far Aaron. This code gives me a internal server error (500).

SunilDVR

Quote from: Aäron on July 13, 2008, 11:59:07 AM

Sorry, yes, I must've missed that.

Find:

        if ($context['can_reply'])
                $buttonArray[] = '<a href="' . $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . '.' . $context['start'] . '.0;do=Bookmark' . $context['bookmark_message'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addbm1.gif" alt="' . $txt[Bookmark] . '" border="0" />' : $txt[Bookmark]) . '</a>';      


Replace with:

        if ($context['can_reply'])
                $buttonArray[] = '<a href="' . $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic'] . '.' . $context['start'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addbm1.gif" alt="' . $txt['bookmark_add'] . '" border="0" />' : $txt['bookmark_add']) . '</a>';


That should work.

Hi Aaron,

That solved the error messages in the log - thanks very much!

Sunil

AlenNS

Why I can't install this mod on my forum?
When I try it says that package is corrupted or not compatible with my forum.

I have SMF 2.0 Beta 3.1 public.

Also, when I tried to install it manual I can't find some part of Display.template.php.

$normal_buttons = array(
'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl .


It just doesn't exist. Not on default theme, not on Babylon I'm using.

AlenNS


Angelotus

Quote from: AlenNS on July 17, 2008, 02:47:41 PM
Any suggestion?

I use this

Quote
// Can the user bookmark the contents of this post?
      if ($context['can_reply'])
         echo ' | <a href="', $scripturl, '?action=bookmarks;sa=add;topic=' . $context['current_topic'], '"><img src="http://www.nessekrekers.nl/favorieten.gif" border="0"/>&nbsp;Bookmark</a>';

AlenNS

@Angelotus I've tried this and it show bookmark link, but when I try to add bookmark or to view bookmark list it shows blank pages.

Does anyone knows that this mod is not compatible with SMF 2.x?
Even the parser tells you that the mod isn't compatible with SMF 2.x.

And on Mod site it says that the mod is for SMF 1.1.x and SMF 2.x...

Can anyone fix this?

http://custom.simplemachines.org/mods/index.php?mod=864

Advertisement: