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: Adding php to photo gallery index.php  (Read 4309 times)

0 Members and 1 Guest are viewing this topic.

brewery15

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Adding php to photo gallery index.php
« on: October 03, 2006, 05:46:49 am »

What is the file that I need to add some php in the upper most portion?  I know php needs to go before everything and anything, but I cant seem to find the correct file?  I tried index.php, but that doesnt seem to be it...Any help would be appreciated, thanks.
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Adding php to photo gallery index.php
« Reply #1 on: October 03, 2006, 06:57:20 am »

Logged
‍I don't answer to PM with support question
Please post your issue to related board

Aeronautic

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 125
  • Photographer / film maker turned webmeister...
Re: Adding php to photo gallery index.php
« Reply #2 on: October 03, 2006, 07:31:50 am »

Have you considered the anycontent.php file as well?

If you only need content on the home page this could work for you - it is a php include unless I'm mistaken.

Doc's here: http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#admin_album_list

Quote
The content of the main page
This option allows you to change the content of the main page displayed by the script.
The default value is "catlist/alblist/random,2/lastup,2"
You can use the following "codes" to include other items (list snipped):

'anycontent': inserts php-generated content that has to reside within the file 'anycontent.php' into the index page. Can be used to include banner-rotation scripts or similar.

I'm using it to explain catalog navigation and search tips, as well as purchase process info. It includes html with hyperlinks.

I don't think you can make it run gallery wide - mods - am I wrong? For that use the header call as Sami pointed out.

And if by uppermost you mean above your gallery's navigation section.
Logged

brewery15

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Adding php to photo gallery index.php
« Reply #3 on: October 03, 2006, 08:08:58 am »

OK I tried creating a custom_header.php and adding the below code to it, and setting the path in my admin config to 'custom_header.php' (minus the ').  And I got the following error msg:

Fatal error: Call to a member function on a non-object in /home/teenyap/public_html/forum/includes/sessions.php on line 134

Code: [Select]

<?php

$phpbb_root_path 
'./forum/';

define ('IN_PHPBB'true);

if (!
file_exists($phpbb_root_path 'extension.inc'))
{
die ('<tt><b>phpBB Fetch All:</b>
$phpbb_root_path is wrong and does not point to your forum.</tt>'
);
}


include_once (
$phpbb_root_path 'extension.inc');
include_once (
$phpbb_root_path 'common.' $phpEx);
include_once (
$phpbb_root_path 'includes/bbcode.' $phpEx);


include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/common.' $phpEx);
include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/stats.' $phpEx);
include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/users.' $phpEx);
include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/polls.' $phpEx);
include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/posts.' $phpEx);
include_once (
$phpbb_root_path 'mods/phpbb_fetch_all/forums.' $phpEx);


$userdata session_pagestart($user_ipPAGE_INDEX);
init_userprefs($userdata);


if (isset(
$HTTP_GET_VARS['start']) or isset($HTTP_POST_VARS['start']))
{
$CFG['posts_span_pages_offset'] = isset($HTTP_GET_VARS['start'])
$HTTP_GET_VARS['start'] : $HTTP_POST_VARS['start'];
if (!intval($CFG['posts_span_pages_offset']))
{
$CFG['posts_span_pages_offset'] = 0;
}
if (!is_numeric($CFG['posts_span_pages_offset']))
{
$CFG['posts_span_pages_offset'] = 0;
}
if ($CFG['posts_span_pages_offset'] < 0) {
$CFG['posts_span_pages_offset'] = 0;
}
}

// fetch new posts since last visit
$new_posts phpbb_fetch_new_posts();

// fetch user online, total posts, etc
$stats phpbb_fetch_stats();

// fetch online users
$online phpbb_fetch_online_users();

// fetch five users by total posts
$top_poster phpbb_fetch_top_poster();

// fetch a random user
$random_user phpbb_fetch_random_user();

// fetch forum structure
$forums phpbb_fetch_forums();

#$member = phpbb_fetch_users();

// fetch a poll
$poll phpbb_fetch_poll();

// fetch a single topic by topic id
// You will need to specify a certain topic id to use this function.
// The first post of that topic will be displayed in a box to the upper right.
$topic phpbb_fetch_topics();

// fetch latest postings
$CFG['posts_trim_topic_number'] = 20;
$recent phpbb_fetch_posts(nullPOSTS_FETCH_LAST);

// fetch postings
$CFG['posts_trim_topic_number'] = 10;
$CFG['posts_span_pages']        = true;
$news phpbb_fetch_posts();

phpbb_disconnect();

?>


« Last Edit: October 03, 2006, 08:17:30 am by brewery15 »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Adding php to photo gallery index.php
« Reply #4 on: October 03, 2006, 11:22:38 am »

The error message you get comes from the files you include, not coppermine. Remember: you can't include anything from anywhere - the file(s) you're going to include need to have been built to support that. Try something less complicated for a start to check if things work as expected and gradually extend your custom header to be able to track the culprit. For a start, your custom_include file just should contain
Code: [Select]
<?php
echo 'Hello world';
?>
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.