coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 (BBS) Integration / Bridging => Topic started by: Owdy on March 11, 2005, 07:42:04 PM

Title: SMF integration and SSI
Post by: Owdy on March 11, 2005, 07:42:04 PM
Can i include smf ssi features in coppermine themes somehow?
Title: Re: SMF integration and SSI
Post by: kegobeer on March 11, 2005, 07:53:06 PM
Not with 1.3.2.  Coppermine and SMF share common function names, especially the database connection functions.  In 1.4 we've renamed all of our functions with a unique prefix to prevent this from happening, but that doesn't help you right now.
Title: Re: SMF integration and SSI
Post by: Joachim Müller on March 12, 2005, 10:25:28 AM
Owdy is an experienced SMF user afaik (at least if you're the same "Owdy" as this one: http://www.simplemachines.org/community/index.php?action=profile;u=272 ), so I guess you could give this a try, not too hard for someone who knows his way around: you need to go through the coppermine code and find all occurences of the function calls for db_query() and replace it with cpg_db_query() - of course you need to re-define the function as well by changing the function name. I don't remember if there is another naming conflict, but it should be easy to find and fix. For a start, use anycontent.php to include the ssi.php code from SMF (read the coppermine docs to find out more about anycontent.php). Imo this could be done by an experienced user (who knows his way around in cpg and smf) in less than 20 minutes. If you're not that experienced (i.e. if you're not the Owdy I think you are), you might wait for the release of cpg1.4 though.

Joachim
Title: Re: SMF integration and SSI
Post by: kegobeer on March 12, 2005, 02:03:05 PM
He posted the same question on SimpleMachines, and I posted the same answer over there.  I explained what to look for and that it is a tedious and time consuming process.
Title: Re: SMF integration and SSI
Post by: Owdy on March 12, 2005, 07:31:21 PM
Yes, same Owdy. I have to test that. Thanks both.
Btw, maybe i am experienced SMF user, but i'm also totally noob with your software. I have used coppermine for couple of days now.  ;)
Title: Re: SMF integration and SSI
Post by: kegobeer on March 12, 2005, 10:33:01 PM
As an experienced SMF programmer you shouldn't have much trouble figuring out Coppermine.  The templating systems are quite different though.
Title: Re: SMF integration and SSI
Post by: Owdy on March 12, 2005, 10:45:09 PM
I am not programmer. Just helping out for those who need it ;)
Title: Re: SMF integration and SSI
Post by: nukeworker on March 14, 2005, 04:36:48 AM
Owdy, look for the theme.php file

Find function pageheader.

(alter to fit your path)

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

   if(empty($smf_welcome)){
      include('http://www.nukeworker.com/forum/SSI.php?ssi_function=welcome');
      $smf_welcome = ob_get_contents();
      ob_clean();
   }

   if(empty($smf_logonline)){
      include('http://www.nukeworker.com/forum/SSI.php?ssi_function=logOnline');
      $smf_logonline = ob_get_contents();
      ob_clean();
   }

   if(empty($smf_boardstats)){
      include('http://www.nukeworker.com/forum/SSI.php?ssi_function=boardStats');
      $smf_boardstats = ob_get_contents();
      ob_clean();
   }
   if(empty($smf_latestmember)){
      include('http://www.nukeworker.com/forum/SSI.php?ssi_function=latestMember');
      $smf_latestmember = ob_get_contents();
      ob_clean();
   }

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
   '{smf_welcome}' => $smf_welcome,
   '{smf_logonline}' => $smf_logonline,
   '{smf_boardstats}' => $smf_boardstats,
   '{smf_latestmember}' => $smf_latestmember,
        );

    echo template_eval($template_header, $template_vars);
}

Then in the template.html use {smf_welcome}, {smf_logonline}, etc...

Has worked for me for a year or so...

Glad I could help a little.  Both sites have helped me so many times.
Title: Re: SMF integration and SSI
Post by: snork13 on March 14, 2005, 05:19:49 AM
Quote from: nukeworker on March 14, 2005, 04:36:48 AM
Owdy, look for the theme.php file

Find function pageheader.

(alter to fit your path)

function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;

  if(empty($smf_welcome)){
     include('http://www.nukeworker.com/forum/SSI.php?ssi_function=welcome');
     $smf_welcome = ob_get_contents();
     ob_clean();
  }

  if(empty($smf_logonline)){
     include('http://www.nukeworker.com/forum/SSI.php?ssi_function=logOnline');
     $smf_logonline = ob_get_contents();
     ob_clean();
  }

  if(empty($smf_boardstats)){
     include('http://www.nukeworker.com/forum/SSI.php?ssi_function=boardStats');
     $smf_boardstats = ob_get_contents();
     ob_clean();
  }
  if(empty($smf_latestmember)){
     include('http://www.nukeworker.com/forum/SSI.php?ssi_function=latestMember');
     $smf_latestmember = ob_get_contents();
     ob_clean();
  }

   header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
   user_save_profile();

   $template_vars = array('{LANG_DIR}' => $lang_text_dir,
       '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
       '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
       '{META}' => $meta,
       '{GAL_NAME}' => $CONFIG['gallery_name'],
       '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
       '{MAIN_MENU}' => theme_main_menu(),
       '{ADMIN_MENU}' => theme_admin_mode_menu(),
   '{smf_welcome}' => $smf_welcome,
   '{smf_logonline}' => $smf_logonline,
   '{smf_boardstats}' => $smf_boardstats,
   '{smf_latestmember}' => $smf_latestmember,
       );

   echo template_eval($template_header, $template_vars);
}

Then in the template.html use {smf_welcome}, {smf_logonline}, etc...

Has worked for me for a year or so...

Glad I could help a little.  Both sites have helped me so many times.

@nukeworker

thanks, it works great. i tested on the classic theme. i assume i can add whatever i want if it's in the SSI.php and call through your script..wow...thanks again i would like to call the latest posts

snork
Title: Re: SMF integration and SSI
Post by: Owdy on March 14, 2005, 08:34:01 AM
Thanks Nuke! I have to test this!
Title: Re: SMF integration and SSI
Post by: Owdy on March 14, 2005, 12:01:59 PM
It works, thank you again! :D

edit: there is only one thing. If i ad menubar with that, it wont regonize me as logged in, it shows login link, not logout.
Title: Re: SMF integration and SSI
Post by: nukeworker on March 14, 2005, 01:24:03 PM
Quote from: Owdy on March 14, 2005, 12:01:59 PM
It works, thank you again! :D

edit: there is only one thing. If i ad menubar with that, it wont regonize me as logged in, it shows login link, not logout.

I've only tested it with the SSI listed above.
Title: Re: SMF integration and SSI
Post by: Owdy on March 14, 2005, 04:08:08 PM
{smf_welcome} does same thing. Hello guest etc.
Title: Re: SMF integration and SSI
Post by: nukeworker on March 15, 2005, 04:20:28 AM
Quote from: Owdy on March 14, 2005, 04:08:08 PM
{smf_welcome} does same thing. Hello guest etc.

Clear your cookies.  Or rename them.
Title: Re: SMF integration and SSI
Post by: Owdy on March 15, 2005, 05:20:48 AM
I have done that, no luck. Coppermine knows im logged in, but that ssi part dont. Weird.
Title: Re: SMF integration and SSI
Post by: nukeworker on March 15, 2005, 05:36:29 AM
Sorry, I'm a noob, thats all I can think of.
Title: Re: SMF integration and SSI
Post by: Owdy on March 15, 2005, 04:05:36 PM
With Coppermine, me too ;)
Title: Re: SMF integration and SSI
Post by: kegobeer on March 15, 2005, 04:59:24 PM
I don't understand the if then branches:

  if(empty($smf_welcome)){
     include('http://www.nukeworker.com/forum/SSI.php?ssi_function=welcome');
     $smf_welcome = ob_get_contents();
     ob_clean();
  }


When the function is called, since none of the $smf_ variables are declared globally, they will always be empty and therefore will always be loaded.  Does this work the same without the if-then brackets?

Also, since SSI looks for the $context variable for user information, it will always show up as a guest because that variable is never set in the smf.inc.php bridge file.  You could try adding the $context variable to the global statements in the smf.inc.php file.  I don't know where $context is initially loaded with data, so I don't know if that variable is even looked at when Coppermine bridges with SMF.  It's worth a try though.