September 06, 2010, 04:19:18 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: The wait is over - Coppermine 1.5.8 [stable] is here
It is with great pride that the Coppermine community announces to the world the immediate availability of Coppermine 1.5.8 stable. As a community of contributors, we have been through celebrations and tribulations. We have had fun, and we have worked hard. We have learned from and helped one another. What started two and a half years ago has grown into what we believe to be the finest PHP photo gallery yet.
[more]
   Home   Help Search Board rules Login Register  
Pages: [1] 2 3   Go Down
  Print  
Author Topic: [How To] Coppermine within SMF  (Read 45992 times)
0 Members and 1 Guest are viewing this topic.
snork13 Topic starter
Contributor
***
Gender: Male
Posts: 260


Internet! Is that thing still around?


WWW
« on: January 02, 2006, 06:07:48 pm »

I shared this over at smf with kegobeer, and thought others might find it interesting here. This hack will allow you to have your forum wrapped around coppermine, assuming you have already bridged the 2 Wink

example:

http://www.snork13.net/forum/index.php?action=gallery


You will need to create the 2 new files: Gallery.php & Gallery.template.php
edit 2 other files: index.php & index.template.php

**3/15/06*** edited Gallery.php to provide a linktree, and uploaded a copy, just remove the .txt Wink

sources/Gallery.php
Code:
<?php
if (!defined('SMF'))
die(
'Hacking attempt...');

Function 
Gallery()
{

global  $txt$scripturl,  $db_prefix$context;
LoadTemplate('Gallery');
$context['page_title'] = "Gallery";
$context['linktree'][] = array(
'url' => $scripturl '?action=gallery',
'name' => $txt['gallery']
);

}

?>


themes/???/Gallery.template.php
Code:
<?php
// Version: 1.1 RC2; Gallery

function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<script language="JavaScript" type="text/javascript"><!--
function checkAll(onOff)
{
for (var i = 0; i < document.searchform.elements.length; i++)
{
if (document.searchform.elements[i].name.substr(0, 3) == "brd")
document.searchform.elements[i].checked = onOff;
}
}
// --></script>
<form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">

 <script type="text/javascript"><!--

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don\'t support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// --></script>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td>Gallery</td>
</tr><tr>
<td class="windowbg">'
;

// load the gallery
echo '<iframe id="myframe" src="http://www.???.com/gallery" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:novisible; width:100%; display:none"></iframe>';

echo '
</td>
</tr>
</table>
</form>'
;
}

?>

/index.php


 find:

Code:
'findmember' => array('Subs-Auth.php', 'JSMembers'),

after add;
Code:
'gallery' => array('Gallery.php', 'Gallery'),


themes/???/index.template

find:
Code:
if ($context['user']['is_logged'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];

after add:
Code:
echo'
<a href="', $scripturl, '?action=gallery">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/gallery.gif" alt="Gallery"' . $txt[''] . '" style="margin: 2px 0;" border="0" />' : $txt['Gallery']), '</a>', $context['menu_separator'];


change www.Huh.com to reflect your actual location, the template has a javascript that allows the iframe to open full, it's the best i could do. It similar to the FlashChat intergration and where i got the idea Smiley

i would also suggestion tweaking the gallery menu to meet your needs, and you could also prevent direct access to the gallery via a .htaccess file

-snork

* Gallery.php.txt (0.32 KB - downloaded 164 times.)
« Last Edit: March 31, 2006, 07:25:51 am by GauGau » Logged
kegobeer
Dev Team member
****
Gender: Male
Posts: 4637


Beer - it does a body good!


WWW
« Reply #1 on: January 02, 2006, 06:10:35 pm »

One thing that doesn't work well at all with this tweak is the config page.  Expanding the options does not expand the "frame" that Coppermine sits in.  Everything else works great.
Logged

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
snork13 Topic starter
Contributor
***
Gender: Male
Posts: 260


Internet! Is that thing still around?


WWW
« Reply #2 on: January 02, 2006, 06:17:59 pm »

One thing that doesn't work well at all with this tweak is the config page.  Expanding the options does not expand the "frame" that Coppermine sits in.  Everything else works great.

yes, i noticed, you have to expand the last option first Undecided

-snork
Logged
conradk
Coppermine newbie

Posts: 1


« Reply #3 on: January 11, 2006, 03:32:26 am »

Hi,

Just wanted to throw in my results...

I'm using coppermine 1.4.3 and SMF 1.1 RC2. All I get is a broken image icon after "Hello, [user]," When I click on the broken icon it gives me a php error that occurred on line 3 of Sources/Gallery.php, some unexpected text encountered... (Sorry, didn't write down the error as I was rushing to get the forum back up.)

I've tried creating a static link in SMF to the gallery, but I lose my login credentials when I do that. Linking out of a topic works fine, though.

Thanks,
Conrad
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #4 on: March 02, 2006, 02:01:30 pm »

1st off, thanks for this mod. 

Now for the big ?'s.

1.  The iFrame isn't expanding at all.  What you see in this screenshot I took is all I can see.  And I can't adjust it.

2.  I'm using a modified version of the default theme, and can't (for the life of me) figure out how to make the "Gallery.gif" look like the others.  I searched forever through all the .gif files, and they all look like the gallery one.  I'm wondering how in the heck I'm supposed to slip the "Gallery" in between the Calendar and Members buttons.

Maybe I'm just tired and did something wrong, but I have triple and quadruple checked my work.  Any suggestions?


* cpgmod.jpg (23.74 KB, 544x444 - viewed 239 times.)
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #5 on: March 02, 2006, 11:37:51 pm »

On second thought, I think I'll just disable bridging alltogether.  For some reason, the only thing that didn't work when I bridged, was the logout.  My forums would NOT let me log out.  Due to this, I'm scrapping the whole "Bridge" thing for now.
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #6 on: March 03, 2006, 01:01:32 am »

UPDATE:  I resume my request for assitance with this.  I now have Coppermine fully bridged and working!  Whew! Grin
Logged
Joachim Müller
Dev Team member
****
Gender: Male
Germany Germany

Posts: 47735


aka "GauGau"


WWW
« Reply #7 on: March 03, 2006, 07:58:55 am »

posting a link to your page might be a good start if you need help Roll Eyes
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #8 on: March 03, 2006, 08:11:36 am »

Sure thing, I just took the mod out becuase it was looking a bit bad the way it came out.

Here's a link to the site: http://atv-edge.com/forum

user/pw: test / test

I put the mod back in, and you'll see that "Gallery" shows up above all the other links, instead of in-line with them.  And the iframe doesn't expand at all, seems to be a fixed height.
Logged
justinkase
Coppermine newbie

Posts: 1


« Reply #9 on: March 14, 2006, 07:18:39 pm »

I just installed both SMF and Coppermine 1.4.4 and have the same problem with the gallery button and the Coppermine frame.

Any suggestions?
Logged
snork13 Topic starter
Contributor
***
Gender: Male
Posts: 260


Internet! Is that thing still around?


WWW
« Reply #10 on: March 15, 2006, 10:49:03 pm »



I just installed both SMF and Coppermine 1.4.4 and have the same problem with the gallery button and the Coppermine frame.

Any suggestions?

accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set

http://www.simplemachines.org/community/index.php?topic=41542.msg512991#msg512991
Logged
aravot
Coppermine regular visitor
**
Gender: Male
United States United States

Posts: 73



WWW
« Reply #11 on: March 15, 2006, 11:51:32 pm »

How to add a tabs (button) to SMF 1.1
Logged
daimmo
Coppermine newbie

Posts: 5


« Reply #12 on: March 20, 2006, 03:32:43 am »

added coppermine latest version to smf 1.1 rc2
bridged following the tutorial on the coppermine documentation
seems to work
but i cannot manage groups and users
the "users" function moves me to the userlist on smf, and that's ok..
the "groups" page does not make what i set
i just want "registered users" to be able to do quite everything on the website (upload to personal and public galleries), plus having "global moderators" (or "administrators") create new public galleries
i'm talking of www.abruzzesi.com and www.abruzzesi.com/gallery
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #13 on: March 29, 2006, 05:10:10 pm »


accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set

http://www.simplemachines.org/community/index.php?topic=41542.msg512991#msg512991

I've been in the middle of moving or I would have replied much sooner, but where is the php.ini file?Huh  I'm feeling stupid for asking, but I've looked almost everywhere and can't seem to find it.  Maybe the move stole some brain cells or something. Huh
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #14 on: March 29, 2006, 05:49:40 pm »


Thanks for that link!  Now if I can only find the php.ini file...lol.
Logged
Joachim Müller
Dev Team member
****
Gender: Male
Germany Germany

Posts: 47735


aka "GauGau"


WWW
« Reply #15 on: March 29, 2006, 08:59:50 pm »

accroding to Senkusha over at smf, In your php.ini, make sure register_long_arrays=On is set
Only applies if you're on PHP5. However, don't worry about it, you wouldn't be able to run coppermine if this setting was wrong, no need to look for php.ini. You usually can't change it anyway when webhosted.
Logged
Starrbuck
Coppermine newbie

Posts: 6


« Reply #16 on: March 30, 2006, 10:31:38 pm »

i would also suggestion tweaking the gallery menu to meet your needs, and you could also prevent direct access to the gallery via a .htaccess file

Hey, snork, this all worked great for me!  I did do some tweaks to the available options in CPG, such as removing the login/logout links and the ability to bring up your profile.

Do you have any examples of how to prevent direct access to the gallery?  I want to only be able to get there from the SMF menu, but I have no idea how to accomplish this...
Logged
Crazie
Coppermine newbie

Posts: 14


« Reply #17 on: March 31, 2006, 01:00:03 am »

Only applies if you're on PHP5. However, don't worry about it, you wouldn't be able to run coppermine if this setting was wrong, no need to look for php.ini. You usually can't change it anyway when webhosted.

That being the case, do you guys have any other suggestions for me?  I don't want to abandon the iframe option, especially when I'm so close to having it working perfectly.
Logged
gofwd
Coppermine newbie

Posts: 1


« Reply #18 on: April 11, 2006, 03:19:53 am »

Sure thing, I just took the mod out becuase it was looking a bit bad the way it came out.

Here's a link to the site: http://atv-edge.com/forum

user/pw: test / test

I put the mod back in, and you'll see that "Gallery" shows up above all the other links, instead of in-line with them.  And the iframe doesn't expand at all, seems to be a fixed height.


I had the same problem.  Java errors 'on' revealed permission denied on IFrame resize due to domain mismatch.  Turns out the $scriptrul in SMF had no 'www' after the 'http:' but cpg had to have it  in Gallery.template.php.  So rather than risk breaking SMF I replaced the $scripturl with the hard url including the 'www' so there was no domain mismatch in the index.template.php file (only one place where the gallery button was added.)
 
Hope this topic is not too cold for a little more input, it has been very helpful to me.
Logged
CoasterJoe.com
Coppermine newbie

Posts: 5


« Reply #19 on: April 26, 2006, 02:23:39 am »

Is there a way to do this while using the Tiny Portal mod for SMF? I'm running this and and I cant seem to find where to change the code in
themes/???/index.template I'm think the mod changes this. Any thoughts?
Logged
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.151 seconds with 19 queries.