News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Site Integration Mod

Started by live627, April 29, 2008, 07:45:20 PM

Previous topic - Next topic

Nathaniel

Yep, just make sure that you put "home" into the setting for the default home page not "action=home". ;)

That's the main change for the new version, even though there are a few other more minor changes and feature additions.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Nathaniel

Okay, I have created a small demo forum for this mod, which I will build on so that it demonstraites some of the more complicated features.

For those of you than wanted a demo....
http://www.verbtest.com/smf2demo/index.php
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

openinteractive

you think its safe to upload the new version over my current Site Integration Mod?
(i have made up backup of files/db of course)
just wondering if there might possibly be a complication. i dont want to break the site while users are online...

Nathaniel

It should be fine to install the lastest version of the Mod. It doesn't have any known errors unless you have the Simple Portal Mod and that has a fix in an earlier post, but I would recommend uninstalling the last version first, otherwise you will get errors from having both versions installed at the same time.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Nathaniel

I have also added a demo site for SMF 1.1.5:
http://www.verbtest.com/smfdemo/index.php

At the moment the demo sites are quite simple, I will try to expand them and add some explanations of features within the demo. Any suggestions for ways to demonstrate this mod would be most welcome... ;)

Thank you,
LHVWB
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

This looks like an awesome mod and I can see the potential of integrating my whole site into smf now!!  AWESOME!!

but, I am a bit new to this.  I've installed the mod (in 2.0) and it seems to be working fine.  The problem I have is I have no idea how to modify the menu to include a tab for forum which would take the user to the regular forum. 

can someone help me out and tell me what I need to learn or do to add to and modify my tabs?

thanks

Nathaniel

@lindaf,
Sure, for SMF 2 Beta, all you need to do to alter your tabs, is to change some code in the "setupMenuContext()" function at the bottom of your "/sources/Subs.php" file. There is a huge array of buttons which you can add yours to.

New buttons look like this:
         'action' => array(
            'title' => 'title',
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
         ),


I will explain each part of that:
The 'action' bit is used to work out if that is the current button or not, it should be exactly the same as the action which you type into your url to get to the page ie index.php?action=test.
The 'title' bit is just the text which will be shown on the button.
The 'href' is the location that the button will send you to.
The 'show' bit is a permissions, it allows you to make it so that only certain groups will be able to see this button, if you are using it with this mod then you could put something like " 'show' => allowedTo("SiteIntegration:action"),", and it will use the permissions set up for the action that you have created using this mod.
Finally the 'subbuttons' bit allows you to put a list of subbuttons, these are only used if your theme supports the kind of pop-up buttons which the Simple Machines Community Forum has for the 'Profile' button and the 'Messages' button.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

 :)oh, AWESOME AWESOME!!!  :D Thank you so much... That all makes sense!!  I've been looking for info like that for a long time, I just haven't been very good at figuring out where to find it!! 

Thank you!  I really appreciate your time to tell me that!

I will go and try that!

if you have time, I have 2 more questions..

in the href  how do you write the url?  ie. as the dir smf is installed being a root? or starting with public_htm/dir/dir etc?
ex: would I do this (... => $smf/file_includes/xyz.php)  where smf is under the public_htm, but smf is where the smf forum is stored.

2nd question.  how does one know if their theme supports pop-up buttons?  Those are pretty cool and I would like to use them if I can.  I just use the default theme right now for 1.1.5 and 2.0 beta


Nathaniel

1. The url should be like "http://www.smfdemo.com/index.php", although if you are putting a link to an internal action then you can put something like "$scripturl . '?action=blah' ", that will use the url value for your smf install '$scripturl' and then add the action part of the url onto the end of it.

2. The default theme for both versions does not support pop-up buttons. Generally with SMF 2 Beta, if a theme supports the pop-up buttons then you will be able to see them when you view the theme for the profile section and etc, because they declared for those areas by default, but the theme has to be able to show them. I have not worked with themes very much, but I am sure that if you ask in the Graphics and Template Forum, somebody will be able to help you with that if you want to add it to the theme.

Also note that SMF 1.1.5 has a different system for changing the Menu stuff, you actually have to manually edit the 'template_menu()' function from the 'index.template.php' file.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

#149
ahh... ok.. that is good info especially about the 1.1.5..  I have I lot to figure out yet!!  :D ;D  thanks!!!

back to adding that button..  what I am trying to do is have the home button use the site integration mod where I will add a bunch of pages etc..  I can get that to happen by putting home in site integration menu --Forum Default/Home Action.  But then I have no forum..  So I am trying to add a button after home that says forum and have the forum show up.

I went to the subs.php file and I added this after the home button:  (in 2 beta)

'forum' => array(
'title' => $txt['forum'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),


but it didn't do anything, no extra menu choice that says forum.  So I am thinking that I didn't do it right!  ::)  What did I do wrong?

[unplugged]

Try this instead for the title:

'title' => 'Forum',
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Nathaniel

#151
@lindaf,
Exactly what SunKing put, unfortunately there is no $txt['forum'] value.
Also remember that you should "clear your file cache", the option is in the forum maintenance section.

You might also want to put

'href' => $scripturl.'?action=forums',

if your forums tab is not your home action anymore.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

#152
I'm getting close!!!  8) ;D   

'Forum' gave me a Forum tab!!

I cleared the cache (thanks for telling me where it was!!)

the action is wrong though cuz it doesn't do anything and have no highlight on it when I click on it.

oh, btw...that $txt came from the code that was already there all the other buttons have it for some reason. (I copied and pasted the code from the home button and then changed what I knew) haha  ;D


p.s.  oh no!! I caught an evil llama and lowered my karma by -3...  oh.. I hope that is not a bad sign for being able to get this to work!!  ;D :D 8) :P

Nathaniel

Yeah, the $txt['home'] bit is referring to a SMF language string, they allow you to define the same variable in a whole series of language files so that if you have more than one language, the $txt['home'] variable will return different strings based on your current language. http://huw.org.uk/smfstrings/

Hmm, in terms of the forum button not working, you will have to make sure that you have set the 'href' to $scripturl.'?action=forum'. I posted the wrong thing, 'forum' not 'forums'. Sry. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

yes!!!..  It works!!! :D ;D 8) :P :)

.........and who said those llama's were evil!!! ;D ;D


I hadn't put anything after $scripturl,

put what you said and it works beautifully!!!  B E A utiful!!!!  (from Bruce Almighty)

Thank you guys so much!!!  This is awesome!!!

Now one last question..  After I play with this, I will want to do this on the forum that is 1.1.5 which is a live forum.  So I will install the mod on that forum, but then when making the forum button, as you mentioned earlier there is a different procedure I have to go through to get the forum button to show and work on the 1.1.5 forum??




Nathaniel

Yep, its much more annoying, You will start to love SMF 2 Beta after a while. ;D

You need to make some edits to the 'template_menu' function from your '/themes/{current theme}/index.template.php'. You have to actually have to perform some edits, here they are because I'm nice:

Replace:

    // Work out where we currently are.
    $current_action = 'home';


With:

     // Work out where we currently are.
     $current_action = 'home';
    // Add the stuff for the 'forum' action.
    if($context['current_action'] == 'forum')
         $current_action = 'forum';


Find:

     // Show the [home] button.
    echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
                    <a href="', $scripturl, '">' , $txt[103] , '</a>
                </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



Add after:

      // Show the [forum] button.
    echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td valign="top" class="maintab_' , $current_action == 'forum' ? 'active_back' : 'back' , '">
                    <a href="', $scripturl, '?action=forum">Forum</a>
                </td>' , $current_action == 'forum' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

oh yes!!  YOU ARE NICE!!  Thank you very much for being nice!!!  I really appreciate it!! I'm so excited, I may stay up tonight and keep working on this!!  ;D :D :) 8)

hey, when I add my files to the file_includes folder, can I add directories?  ie. file_includes/articles and then put a bunch of files in articles which I will call from the page I display under the home tab or do I have to put them all in file_includes?

ok.. I'll stop asking questions!!!!


Thank you very very much for all your help!!!

Nathaniel

You can have as many sub directories as you like, but the mod won't include the files in them unless you specify the sub directory in the folder includes setting, so you can put into something like "file_includes, file_includes/articles", into the setting to get it to load files from both folders.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lindaf

oh yes!! This is a great night!!!! ;D :D  it works too, it picked up all the files!!!! :D ;D :)

by any chance in the folder includes does it recognize ..   to go up a folder?? i.e.      ../images   ?  (I might be pressing my luck on that one eh!!)  :D ;D

Nathaniel

I think that you are referring to the location of any relative images or etc. that are used from one of the included actions.

As per the documentation on the download page:
"Also be aware that when you view your page it will be treated as if it is at the root of your SMF directory, because of the integration. This will effect any relative locations which you are trying to use."

This means that any images or links will be treated as if they are in the index.php page for your smf install, because of them being included they are now at the index.php file.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Advertisement: