Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Editing theme.php  (Read 6177 times)

0 Members and 1 Guest are viewing this topic.

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Editing theme.php
« on: August 22, 2004, 07:01:22 am »

I'm adding some custom php to the "header", ex:
Code: [Select]
'{test}' => test(),. Every time I make the funtion under the $template_vars array. I get errors. Am i putting the funtion in the wrong place? I noticed in the FAQ it tells you how to customize the array but don't tell you where to put a var or funtion at. Any help on this would be great. Thanks. :)
« Last Edit: August 23, 2004, 01:39:12 am by quake101 »
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #1 on: August 22, 2004, 09:26:50 pm »

I still need help with this. :(
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Editing theme.php
« Reply #2 on: August 23, 2004, 12:27:24 am »

allow days for answers, not hours - this is not a hotline. >:(

GauGau
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #3 on: August 23, 2004, 01:34:28 am »

I only posted "I still need help with this" cuz you moved the post. I started this post last night also. I didn't wait hours. It's been almost a day and I haven't gotten anything from the post yet. :( I also don't understand this, you took the time to tell me it's not a hotline but didn't take the time to help me. From your profile it looks like your the admin and project leader. I would think you could help me in a matter of mins.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Editing theme.php
« Reply #4 on: August 23, 2004, 07:07:03 am »

obviously you're wrong: although I'm the project leader, I'm not the only supporter. There's no law that a supporter who moves a thread posted on the wrong board will have to take care of the issue. I repeat: this is not a hotline, alow days for answers, not hours. I didn't post an answer, because your question has been poorly written. The code snippet you posted doesn't mean anything - you will have to post the full code you have come up with so far, plus a description what you actually want to do. If you haven't come up with more code than the snippet you posted so far, then maybe you shouldn't change anything at this level of coding, since more coding skills are required to actually create a custom function within theme.php.
Neglecting board rules (posting an the wrong board, bumping too early) usually means a supproter is reluctant to help in the first place; that's why you get a slower response. I recommend you review your attitude; this is a support board of an open source app, where development and support is done by volunteers - you have no right on support, as you haven't piad a cent for the software.

GauGau
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #5 on: August 23, 2004, 04:41:43 pm »

I never though this was a hotline nor said it was. I'm just smiply looking for some help. I just thought it was odd that you would take the time to yell at me and not just say "The code you included doesn't help, please give us a little more info or code then that". I'm sorry if i ticked you off I'm not here to make anyone mad. I'm just here for some help. Here is some more of the edited code from my theme.php. I hope this helps a bit more.

Code: [Select]
    $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(),
        '{test}' => test(),
        );
    funtion test(){
    echo "wooho it worked";
    }
    echo template_eval($template_header, $template_vars);
Logged

Nibbler

  • Guest
Re: Editing theme.php
« Reply #6 on: August 23, 2004, 07:22:26 pm »

You spelled function wrong for a start, and the function must be declared before you attempt to call it. This is just basic php.
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #7 on: August 23, 2004, 07:56:01 pm »

I have put the function before the arrary and i still got errors.
Logged

Nibbler

  • Guest
Re: Editing theme.php
« Reply #8 on: August 23, 2004, 08:06:49 pm »

Care to post the errors ?
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #9 on: August 23, 2004, 08:17:26 pm »

This is the code with the function before the array.
Code: [Select]
   function test(){
    echo "yay";
    }
    $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(),
        '{test}' => test(),
        );
    echo template_eval($template_header, $template_vars);
Here is the error I get.
Fatal error: Call to undefined function: () in /home/test/public_html/gallery/themes/default/theme.php on line 823
« Last Edit: August 23, 2004, 08:22:29 pm by quake101 »
Logged

skybax

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 180
    • SKYBAX Communications
Re: Editing theme.php
« Reply #10 on: August 23, 2004, 09:00:30 pm »

You seem to break away from the style of coding for the header information. Also did you call {test} from within your template.html?

I added the ability to add a javascript onload command to the body tag. Here's the code for the answer to your question....

Code: [Select]
function pageheader($section, $meta = '', $javascript_onload_var = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;
    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
if ($javascript_onload_var != ""){
$javascript_onload_var = ' onLoad="' . $javascript_onload_var . '"';
}else{
$javascript_onload_var = "";
}
    user_save_profile();
    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
'{JAVASCRIPT_ONLOAD}' => $javascript_onload_var,
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU1}' => theme_main_menu1(),
        '{MAIN_MENU2}' => $include_main_menu2,
        '{ADMIN_MENU}' => theme_admin_mode_menu()
        );
    echo template_eval($template_header, $template_vars);
}

Then within template.html I added {JAVASCRIPT_ONLOAD} where I wanted the onload function to appear.

-T
« Last Edit: August 23, 2004, 10:28:34 pm by skybax »
Logged
(http://www.skybax.com/hotImage/post_footer.gif)
Don't contact me for support over PM or email unless I requested you to do so. Instead: post on the proper board.

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #11 on: August 23, 2004, 09:22:09 pm »

I do have {test} in the template.html
Logged

skybax

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 180
    • SKYBAX Communications
Re: Editing theme.php
« Reply #12 on: August 24, 2004, 02:33:14 pm »

why not just use a if statement? because it seems that what you are doing would qualify for a simple if/else statement. also captialize the text between the { } (I didn't test this - but that could be what's giving you issues as well?).
Logged
(http://www.skybax.com/hotImage/post_footer.gif)
Don't contact me for support over PM or email unless I requested you to do so. Instead: post on the proper board.

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #13 on: August 24, 2004, 06:33:23 pm »

Good call skybax i'll give that a shot. :)
Logged

quake101

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 44
Re: Editing theme.php
« Reply #14 on: August 24, 2004, 10:24:33 pm »

If i just just a var everything works fine, but I need to use a function. Bah I might just have to rewrite my script. :(
Logged

skybax

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 180
    • SKYBAX Communications
Re: Editing theme.php
« Reply #15 on: August 24, 2004, 10:33:35 pm »

Why don't you post the code you are actually trying to use that way we can debug it for you, just putting up "test" won't help either one of us.

-T
Logged
(http://www.skybax.com/hotImage/post_footer.gif)
Don't contact me for support over PM or email unless I requested you to do so. Instead: post on the proper board.
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.