News:

SMF 2.1.4 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

slackerpunk

hi i have it installed successfully I see ADD BOOKMARK on the menu on top when you open up a thread but where do I get the My Bookmarks link

Aaron

Quote from: slackerpunk on January 19, 2008, 06:26:28 AM
ei thanks... was that a site bug?

Yep. Server problems the other day.

Quote from: slackerpunk on January 19, 2008, 06:37:39 AM
hi i have it installed successfully I see ADD BOOKMARK on the menu on top when you open up a thread but where do I get the My Bookmarks link

You need to edit your custom theme's index.template.php to include the bookmark button in the template_menu() function.

slackerpunk

do I edit index.template.php or display.template.php?

slackerpunk

by the way my current theme is only using index.template.php no other

Aaron

index.template.php.

Find:

if (in_array($context['current_action'], array('search',


Replace with:

if (in_array($context['current_action'], array('search','bookmarks',


Find:

// The [calendar]!


Add before:

    // The [bookmarks] button
if ($context['user']['is_logged'])
echo ($current_action == 'bookmarks' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'bookmarks' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=bookmarks">' , $txt['bookmarks'] , '</a>
</td>' , $current_action == 'bookmarks' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

slackerpunk

hey thanks I read that rather late hehe browsed docs and checked the modification and found it.. nice mod keep it up thanks a lot

woolly bugger

Thanks Aäron!

That's just what I needed!!!

vlindertje

Quote from: Aäron on January 19, 2008, 07:01:02 AM
index.template.php.

Find:

if (in_array($context['current_action'], array('search',


Replace with:

if (in_array($context['current_action'], array('search','bookmarks',


Find:

// The [calendar]!


Add before:

    // The [bookmarks] button
if ($context['user']['is_logged'])
echo ($current_action == 'bookmarks' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'bookmarks' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=bookmarks">' , $txt['bookmarks'] , '</a>
</td>' , $current_action == 'bookmarks' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


I quote this part, because i get problems, when i follow this.   :o
My code is a little different, so thats maybe it goes wrong.

I will write here my code of this part (index.template.php).

This is with the first thing what i have to change, you can see its a little different that wat you say. So i don't know where i have to change it in my code:
// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];


Then we have the second part of adding the bookmark code before the calender:

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];


What you can see, my code is different that your code. And when i do exactly what you write, i get errors in this those parts. So i really like if you can tell me how to change and add it in my kind of code. :D

Aaron

You've got images instead of text links, so yes, you need to do add a different piece of code, plus you'll need to make an extra image for the bookmarks button. :)

Find the code for the calendar button:

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];


And add before that:

// The [bookmarks]!
if ($context['user']['is_logged'])
echo '
<a href="', $scripturl, '?action=bookmarks">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/bookmarks.gif" alt="' . $txt['bookmarks'] . '" border="0" />' : $txt['bookmarks']), '</a>', $context['menu_separator'];


That should do the trick. Don't forget to put a bookmarks.gif in /Themes/themename/images/dutch! :)

vlindertje

This really helps me, thanx :D
I see also what you changed, so for the next time for other things, i can change it at the same way.
This part of the mod works now :D

Only there is another part it doesn't work. Thats the button in the topic to get it in the bookmarks.

I also used this site: http://www.smfhacks.com/packageparser/package.php
And there i found that i have to change in the display.template.php

And there i found also different codes instead what the site says.

In file Themes/[your theme]/Display.template.php
Find: 
   $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']),


Replace with:

   $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', 'lang' => true, 'url' => $scripturl . '?action=bookmarks;sa=add;topic=' . $context['current_topic']),


And then my code on this part, what looks like the same a little:

$buttonArray = array();
if ($context['can_reply'])
$buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/reply.gif" alt="' . $txt[146] . '" border="0" />' : $txt[146]) . '</a>';


I hope that i give now the right information, because i couldn't find something else what look like the same.

vlindertje

Hello,

Yesterday is was to tired, but today i take my time.  So i set all the codes on a row. And then i take a look what can i change. And i try it and yes, i have the right code :D

I made:

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


And Aäron very thanx for your help. It works very fine now :D

Krysia

Hi Aäron,

I've installed everything manually, and I have the text where it should be in the index.template.php and display.template.php files... But no Bookmarks option appears. Is there a conflict with the "Contact" mod?

~ Krysia



Krysia

In addition, I tried doing the table manually for the bookmarks mod, because it doesn't look like a table exists for it, and I get this error:

QuoteError
SQL query:

db_query(
"
   CREATE TABLE IF NOT EXISTS {$db_prefix}bookmarks
   (
      `ID_MEMBER` mediumint(8) unsigned NOT NULL,
      `ID_TOPIC` mediumint(8) unsigned NOT NULL,
      UNIQUE KEY `ID_MEMBER` (`ID_MEMBER`,`ID_TOPIC`)
   )", __FILE__, __LINE__
)

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'db_query("
    CREATE TABLE IF NOT EXISTS {$db_prefix}bookmarks
     



Aaron

If you run this query manually in PHPMyAdmin:


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`)
);


It should work just fine. :) Note that if you use a table prefix other than "smf_", you'll need to change that part of the query. :)

Krysia

Thank you... That did the trick insofar as table creation. :)

Unfortunately, I still see nothing (there isn't any text in the header, or anywhere, for that matter), nor do I see any setting in the Admin center for it.

I don't understand it, as I rechecked the manual install several times.

Where am I supposed to look for the settings, etc? Is it in the Features section in the Admin panel?



vlindertje

Quote from: Krysia on January 22, 2008, 08:11:53 PM
Where am I supposed to look for the settings, etc? Is it in the Features section in the Admin panel?

I also install it few days ago. But there is no features section in the admin. And by my works fine now :D

Which theme you used?
Did you change the things in your own theme? Because in the first time i didn't see also on my own theme nothing.

Krysia

Quote from: vlindertje on January 23, 2008, 03:35:28 AM
Quote from: Krysia on January 22, 2008, 08:11:53 PM
Where am I supposed to look for the settings, etc? Is it in the Features section in the Admin panel?

I also install it few days ago. But there is no features section in the admin. And by my works fine now :D

Which theme you used?
Did you change the things in your own theme? Because in the first time i didn't see also on my own theme nothing.
I used my own theme which is essentially the default with different graphic colors.

I've installed 24 mods; more than half manually; you'd think I'd have a handle on it by now. I don't get it.



Aaron

Quote from: vlindertje on January 23, 2008, 03:35:28 AM
I also install it few days ago. But there is no features section in the admin.

There isn't supposed to be any, either! ;D

Quote from: Krysia on January 23, 2008, 09:14:35 PM
I used my own theme which is essentially the default with different graphic colors.

I've installed 24 mods; more than half manually; you'd think I'd have a handle on it by now. I don't get it.

Have you modified your index.template.php and Display.template.php, though? If you haven't, the buttons won't appear in your own theme.

Altair

Hey Aaron, Altair again. Do you plan on updating this mod for SMF 2?

Aaron

Already have, actually, for one of my own forums that runs on SMF 2.0. :D

Advertisement: