SMF integration and SSI SMF integration and SSI
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

SMF integration and SSI

Started by Owdy, March 11, 2005, 07:42:04 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.


kegobeer

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.
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

Joachim Müller

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

kegobeer

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.
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

Owdy

#4
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.  ;)

kegobeer

As an experienced SMF programmer you shouldn't have much trouble figuring out Coppermine.  The templating systems are quite different though.
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


nukeworker

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.

snork13

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


Owdy

#10
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.

nukeworker

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.






kegobeer

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.
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