forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: Col. Kurtz on August 24, 2005, 09:42:12 pm

Title: execute php code in kubrik sidebar
Post by: Col. Kurtz 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?
Title: Re: execute php code in kubrik sidebar
Post by: Nibbler 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
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz 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
Title: Re: execute php code in kubrik sidebar
Post by: Nibbler on August 24, 2005, 10:11:04 pm
Please post your changes.
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz 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);
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz 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');
Title: Re: execute php code in kubrik sidebar
Post by: Nibbler 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();
}
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz 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?
Title: Re: execute php code in kubrik sidebar
Post by: Nibbler on August 24, 2005, 11:09:19 pm
Use a path as instructed, not an url.
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz 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
Title: Re: execute php code in kubrik sidebar
Post by: Nibbler 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.
Title: Re: execute php code in kubrik sidebar
Post by: Col. Kurtz on August 25, 2005, 06:51:50 am
Ok thank you anyway.