Advanced search  

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

Pages: [1]   Go Down

Author Topic: execute php code in kubrik sidebar  (Read 5446 times)

0 Members and 1 Guest are viewing this topic.

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
execute php code in kubrik sidebar
« on: August 24, 2005, 09:42:12 pm »

Hello,

Is it possible to execute php code from another program in the kubrick template sidebar?
I use Serendipity ( a blog software) and my own modified kubrick theme in both applications. IŽd llike to show things from an Serendipity plugin. I was told to enter 3 lines of code if I can execute php there.

Is this possible?
If yes: Where to put those 3 lines?
Logged

Nibbler

  • Guest
Re: execute php code in kubrik sidebar
« Reply #1 on: August 24, 2005, 09:44:42 pm »

Set it up a custom header/footer as in the docs.

http://coppermine.sourceforge.net/faq.php#customHeader
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #2 on: August 24, 2005, 10:07:02 pm »

I followed those instructions, changed the path and get this error:

Parse error: parse error, unexpected '(', expecting ',' or ';' in /www/htdocs/w0058a3a/cm/themes/test/theme.php on line 777
Logged

Nibbler

  • Guest
Re: execute php code in kubrik sidebar
« Reply #3 on: August 24, 2005, 10:11:04 pm »

Please post your changes.
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #4 on: August 24, 2005, 10:11:52 pm »

Code: [Select]
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;

   if(empty($custom_header)){
      include('http://www.test.hohle-phrasen.de/s9y/serendipity_config.inc.php');
      static $custom_header = 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(),
      '{CUSTOM_HEADER}' => $custom_header,
   );

   echo template_eval($template_header, $template_vars);
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #5 on: August 24, 2005, 10:14:59 pm »

The code I was supposed to enter is:

include_once "/path/to/serendipity/serendipity_config.inc.php";
serendipity_plugin_api::generate_plugins('*', '', false, 'serendipity_plugin_linklist');
serendipity_plugin_api::generate_plugins('*', '', false, 'serendipity_plugin_recententries');
Logged

Nibbler

  • Guest
Re: execute php code in kubrik sidebar
« Reply #6 on: August 24, 2005, 10:40:22 pm »

Change this

Code: [Select]
   if(empty($custom_header)){
      include('http://www.test.hohle-phrasen.de/s9y/serendipity_config.inc.php');
      static $custom_header = ob_get_contents();
      ob_clean();
   }

to this

Code: [Select]
   if(empty($custom_header)){

include_once "/path/to/serendipity/serendipity_config.inc.php";
serendipity_plugin_api::generate_plugins('*', '', false, 'serendipity_plugin_linklist');
serendipity_plugin_api::generate_plugins('*', '', false, 'serendipity_plugin_recententries');

static $custom_header;
$custom_header = ob_get_contents();
ob_clean();
}
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #7 on: August 24, 2005, 10:58:41 pm »

done

new error message:


Warning: pageheader(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /www/htdocs/w0058a3a/cm/themes/test/theme.php on line 777

Warning: pageheader(http://www.test.hohle.phrasen.de/s9y/serendipity_config.inc.php): failed to open stream: Success in /www/htdocs/w0058a3a/cm/themes/test/theme.php on line 777

Warning: pageheader(): Failed opening 'http://www.test.hohle.phrasen.de/s9y/serendipity_config.inc.php' for inclusion (include_path='.:/usr/share/php') in /www/htdocs/w0058a3a/cm/themes/test/theme.php on line 777

Fatal error: Undefined class name 'serendipity_plugin_api' in /www/htdocs/w0058a3a/cm/themes/test/theme.php on line 778



looks like this is not working huh?
Logged

Nibbler

  • Guest
Re: execute php code in kubrik sidebar
« Reply #8 on: August 24, 2005, 11:09:19 pm »

Use a path as instructed, not an url.
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #9 on: August 24, 2005, 11:26:02 pm »

hmm ok

now it tries to access a file from the s9y folder, and cannot find it in the cpg folder.

"The requested URL /cm/serendipity_admin.php was not found on this server."

hmm
Logged

Nibbler

  • Guest
Re: execute php code in kubrik sidebar
« Reply #10 on: August 24, 2005, 11:30:26 pm »

I don't know enough about serendipity to be able to help you with that I'm afraid.
Logged

Col. Kurtz

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: execute php code in kubrik sidebar
« Reply #11 on: August 25, 2005, 06:51:50 am »

Ok thank you anyway.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.