News:

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

Main Menu

Coppermine Button and other wrapping fixes!

Started by Goosemoose, February 19, 2005, 01:49:41 AM

Previous topic - Next topic

Goosemoose

Okay, I spent the last hour trying to figure out how to put a button linking to my users coppermine galleries below their avatars, but still opening in a mambo page. I also found out how to make wrapped pages like coppermine to go back to the top of the page after clicking on a link. The solution not only works but also allows us to pass ANY variables to a wrapper. Note I just merged a whole bunch of different solutions together and hacked them up so they would work for us.

First, insert the following code before the words "// auto height control" in wrapper.php in your wrapper components folder.

// pass all except Mambo specific parameters to the wrapper
    $allparams = '?';
             
    if (isset( $_GET['option'] ))
      $workarray = $_GET;
    if (isset( $_POST['option'] ))
      $workarray = $_POST;
             
    reset($workarray);

    while (list($key, $val) = each($workarray)) {
    if (($key != 'option') && ($key != 'Itemid'))
        $allparams = $allparams . $key . '=' . $val . '&';
    }
    $row->url = $row->url . $allparams;


Now open your display.template.php in your theme and add the following code after where you want the gallery link to occur, I placed mine below the personal text which you can find by searching for:
// Show their personal text?


// Add for personal gallery
      echo '
', '<a href="' . $mosConfig_live_site . '/index.php?option=com_wrapper&Itemid=66&cat=', $message['member']['id']+10000, '"/><img border="0" src="' . $settings['images_url'] . '/gallery.gif" width="75" height="35" alt="" /></a><br />';



How this is going to work (this is for the info of those who want to use this elsewhere):
Now anytime you call a wrapper from smf or anywhere else anything that you add to the end of the link with &putparamatershere will get added on to the actual wrapped page. For example if you want to link to a user gallery the address is usually http://www.yoursite.com/coppermine/index.php?cat=15031 but your coppermine wrapper is actually something like http://www.yoursite.com/index.php?option=com_wrapper&Itemid=66, and it wraps http://www.yoursite.com/coppermine/index.php. Now that we have edited wrapper.php if you call the wrapped item by saying http://www.yoursite.com/index.php?option=com_wrapper&Itemid=66&cat=10001 the &cat=10001 will become ?cat=10001 and get appended to the http://www.yoursite.com/coppermine/index.php and become a link to that users gallery, http://www.yoursite.com/coppermine/index.php?cat=10001.


Let me know if you get this to work, or if you need help! This can really help with integrating other mambo/smf items.

Goosemoose

Oh I forgot to post the code to make coppermines wrapped page return to the top when you click on a link. In wrapper.html.php

Insert the following twice into your iFrameHeight:
parent.scrollTo(0,0);

so your function looks like this:

function iFrameHeight() {
var h = 0;
if ( !document.all ) {
h = document.getElementById('blockrandom').contentDocument.height;
document.getElementById('blockrandom').style.height = h + 60 + 'px';
parent.scrollTo(0,0);
} else if( document.all ) {
h = document.frames('blockrandom').document.body.scrollHeight;
document.all.blockrandom.style.height = h + 20 + 'px';
parent.scrollTo(0,0);
}
}

Goosemoose

Oh, you need to upload this image to your themes image folder. I grabbed this from somone else's thread on the forum but I forget who.

trenchteam

Will this work for other packages as well as a work around the wrapper, or is this for Coppermine only?  Do you think this will work for the arcade rooM?

Goosemoose

This will work for any wrapped component. Which arcade room are you talking about?

trenchteam

The Arcade by Niko for SMF.  I can get the arcade in the wrapper, but none of the games work using the bridge. It has to be outside of the portal using /forums not /portal

Goosemoose

This will help with going the other way around, i.e. putting things that weren't meant in mambo and creating links to them in smf. To get the arcade wrapper to work you need to do the same thing you did for getting chat to work. Make sure you make any changes that were for index.php to the smf.php file and change obexit() to return()

bmwheaven

Sh*t happens
All the time


Kindred

in order to make this even simpler (and not require hardcoding the site), I believe you could use the following in place of the hardcoded call to the coppermine wrapped site:


// Add for personal gallery
      echo '
', '<a href="' . $mosConfig_live_site . '/index.php?option=com_wrapper&Itemid=66&cat=', $message['member']['id']+10000, '"/><img border="0" src="' . $settings['images_url'] . '/gallery.gif" width="75" height="35" alt="" /></a><br />';



Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

chadness

Goosemoose, this is awesome!  Worked like a charm. 

Kindred beat me (as usual) to the suggestion for how to code the site address.  But, I coded it like this:

            // Add for personal gallery
            echo '
                            ', '<a href="' . $mosConfig_live_site . 'index.php?option=com_wrapper&Itemid=38&cat=', $message['member']['id']+10000, '"/><img border="0" src="' . $settings['images_url'] . '/gallery.gif" width="75" height="35" alt="" /></a><br />';

Note that I removed the / from in front of index.php.  If I leave that in, my development site links to the root, instead of the /dev subdirectory it is in.

NoRad

Awesome. Worked for me like a charm! Thank you for making this post / modification so easy to use.

NoRad

p.s. Anybody combine this with the other hack where we can only display the gallery button if they *have* a gallery?

Goosemoose

Hmm, if you have bridge coppermine and smf, everyone should have a gallery, even if nothing is in it. Do you mean it would only appear if there were no albums?

NoRad

Everybody can have a gallery, but it's not automatically created by default. So if they don't it just says "No album configured for this user" or something like that. If they do, you see their albums/pictures. So what I'd like to do is display 1 button if they have a gallery and another button if they don't...

Goosemoose

Hmm. If my users have not created an album yet they still end up in a default gallery like this:
Home > User galleries > chaos_in_motion and it says "No image to display" for the gallery. It sounds like your users are not being shared properly. Can you give me a link to a user who does not have a gallery? You can see one of mine here: http://www.goosemoose.com/index.php?option=com_wrapper&Itemid=66&cat=16083

NoRad

That's the exact same thing I get, but why send a user to that page? It would be more user-friendly to just let them know that this chump doesn't have a gallery yet... so don't bother clicking. ; )

Goosemoose

True. I leave it there because it encourages my users to use the photo albums. They don't want others clicking on it and seeing no pics.

NoRad

I'd love to display up to 4 thumbnails in addition to the avatar on their profile page that are pulled from the user's coppermine gallery. Anybody want to take a stab at this?  ;)

Goosemoose

Orstio is working on a mambo-smf bridged profile page that allows users to create their own profile with html and everything. You could give instructions on how to call the html function in coppermine to display 4 pictures.

Advertisement: