forum.coppermine-gallery.net
Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: smoke10010 on August 26, 2005, 02:52:02 am
-
i've learned how to use custom_headers and got the basic idea.. but it seems like the only thing i'm able to include is straight up html.. i'm sure i'm just lacking the knowledge required... i've searched through a lot of threads already and most of them just get custom_header working i want to go to the next step...
I'd like to get this working inside my template or include it somehow using custom_header... like i said the only thing i've been able to include is straight up html.
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/");
$styleguide = array(
"alttag" => "%w %t - %h hits",
"imagestyle" => "photoclip",
"imagesize" => 'thumb');
$objCpm->cpm_viewRandomTopRatedMediaFrom("",6,1,$styleguide);
$objCpm->cpm_close();
?>
if you could point me to another thread or have an idea what to search for in the forums that would help a lot.
-
Post cpmfetch questions on the cpmfech thread, just like any other mod.
-
no this isn't a problem with cpmfetch.. that's just an example of a piece of code i want to get working inside the custom_header but don't know how
that bit of cpmfetch code works perfectly fine
-
OK, so post your code that does not work.
-
i have this which i editted in theme.php... and this all works.. i think anyway..
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
if(empty($custom_header)){
include('highest_rated.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);
}
and then in the file highest_rated.php i have this
*** HTML ***
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/");
$styleguide = array(
"alttag" => "%w %t - %h hits",
"imagestyle" => "photoclip",
"imagesize" => 'thumb');
$objCpm->cpm_viewRandomTopRatedMediaFrom("",6,1,$styleguide);
$objCpm->cpm_close();
?>
*** Closing HTML ***
i get this error
Fatal error: Call to a member function on a non-object in /home/tpimp/public_html/themes/trendpimp/theme.php on line 965
-
Change this:
include "./cpmfetch/cpmfetch.php";
to this
require "./cpmfetch/cpmfetch.php";
Then you should get an error message that will help you sort out the correct path to use.
-
i'm still getting the same error
-
this is line 965
$main_menu = $ns -> tablerender($CONFIG['gallery_name']." - ".$CONFIG['gallery_description'], $main_menu);
-
That's not Coppermine code, I can't help you with that.
-
the CPM Fetch stuff or that line i pasted..
everything here is from theme.php and i've barely modded theme.php the only things i've changed around are the html layout...
-
The line you posted is not Coppermine code, it must be e107 code which I know nothing about. The e107 port is not supported here.
-
this post i accidently posted somewhere else.. real sorry guys didn't mean to make a mess of your forums
i remember way back in the day porting from e107 to coppermine and i mist have accidently copied that code over and made everything go wonky... i rebuilt another theme.php and i don't get any errors... the only thing now is when i try to use {CUSTOM_HEADER} it just shows up as {CUSTOM_HEADER} and doesn't include anything.. but i think i remmeber reading about that on the forums.. if i find a thread that solves my problems i'll link it here
thanks for your help nibbler
-
ok now i get this
Fatal error: Cannot instantiate non-existent class: cpm in /home/tpimp/public_html/highest_rated.php on line 15
and line 15 is this
$objCpm = new cpm("/");
-
Right, that means the file containing cpmfetch was not included. Check the path to it is correct. You can enter a full server path if you are unsure.
-
Instead of custom_header showing up i get a {CUSTOM_HEADER} popping up and not the actual content
this is the code i'm using
function pageheader($section, $meta = '')
{
global $CONFIG, $THEME_DIR;
global $template_header, $lang_charset, $lang_text_dir;
if(empty($custom_header)){
include('highest_rated.php');
/*static*/ $custom_header = ob_get_contents();
ob_clean();
}
$charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
header("Content-Type: text/html; charset=$charset");
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);
}
why is it not displaying as the content within highest_rated.php and instead just displaying {CUSTOM_HEADER}
-
Make sure the {CUSTOM_HEADER} comes before the {GALLERY} in your template.html. If it comes afterwards then you need to treat it as a custom footer instead.