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: PHP problem  (Read 9461 times)

0 Members and 1 Guest are viewing this topic.

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
PHP problem
« on: December 25, 2006, 11:55:12 am »

Welcom Everyone!
I got big problem:
I changed in include/init.inc.php
Code: [Select]
define('TEMPLATE_FILE', 'template.html');to
Code: [Select]
define('TEMPLATE_FILE', 'template.php');It works. I neeed my template to be php file;)

But php in template.php doesn't work:|
Hmm... I tried even to test and <?php echo "TEST"; ?> doesn't work. Has anyone got any idea?
« Last Edit: December 28, 2006, 08:12:06 pm by Nibbler »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #1 on: December 25, 2006, 12:00:07 pm »

Changing the name of the template file doesn't do anything, it doesn't make PHP parsed in that file. The name could be anything. Turn it back to how it used to be (template.html).
You can't have PHP in the template file directly. Use the placeholder tokens instead ({CUSTOM_HEADER} and {CUSTOM_FOOTER} instead. If you have got them running and need more, feel free to add them.
Instead of trying to accomplish something that can't be done because of the way Coppermine works I suggest that you tell us instead what bit of PHP code you want to see parsed in which spot.
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #2 on: December 25, 2006, 12:05:28 pm »

The main problem is that I use somethink like this:
Code: [Select]
?module=Guestbook&lang=".$currentlang."
How to aplly this in my gallery?

I'm a special kind of php newbie;) I try everything to make by myself and in 80% I did;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #3 on: December 25, 2006, 12:32:37 pm »

So what you actually want to do is add a custom link to coppermine's menu that points to your guestbook with the currenty language of the visitor as a parameter?
To add a custom link to Coppermine's menu you'll have to edit themes/yourtheme/theme.php (not template.html) - this is being covered in many postings already. Posting a link to your coppermine-driven gallery might be a good start. Zip your custom theme and attach it to your posting (using "additional options" when composing your message).

Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #4 on: December 25, 2006, 12:37:11 pm »

I just edited classic theme. Over the main table I put my header, and above - my footer. But i have something like this
[oryginally] eg.
Code: [Select]
<a class="hide" href="#" title="Home"><img src="images/menu/home<?php ".$currentlang."?>.png" class="link1" alt="Home" /></a>and I don't now how to make it working in templates.

I "integrated" gallery with my site this way, cause its unable to use include or require.
I need only - I think - to define $currentlang in theme.php?
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #5 on: December 25, 2006, 01:44:06 pm »

I found this, http://www.bullseyephotos.com/blog/?p=40 but now  I get T_DOUBKE_ARROW error
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #6 on: December 25, 2006, 02:33:00 pm »

Posting a link to your coppermine-driven gallery might be a good start.
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #7 on: December 25, 2006, 02:37:26 pm »

Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #8 on: December 27, 2006, 12:29:06 am »

Does anyone know?
Logged

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
Re: PHP problem
« Reply #9 on: December 27, 2006, 04:08:49 pm »

What is it exactly that you to accomplish by adding php code to your gallery?
Logged
Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #10 on: December 27, 2006, 11:16:32 pm »

I will have functional menu which contains php code. It's a bit important ;D Menu from my layout, not menu in coppermine. I can't imagine not using coppermine on my site;) If I'm thinking good I can replace php by {TAG}? But when I try in my theme.php i get Double_T Error.
Logged

Nibbler

  • Guest
Re: PHP problem
« Reply #11 on: December 28, 2006, 12:36:03 am »

Post your code.
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #12 on: December 28, 2006, 09:09:22 am »

Code: [Select]
<li><a href="index.php?module=biography&lang=<?php ".currentlang." ?> title="">Fixed 3</a></li>

This is part from the menu.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #13 on: December 28, 2006, 09:31:39 am »

That's pseudo-code that won't do anything. You'll have to echo/print your output. The var that get's populated by Coppermine is $CONFIG['lang'].
Subsequently, your code should be something like
echo '<li><a href="index.php?module=biography&lang=' $CONFIG['lang'] . '" title="">Fixed 3</a></li>';
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #14 on: December 28, 2006, 12:00:04 pm »

Code: [Select]
<li><a href="index.php?module=biography&lang=<?php ".currentlang." ?> title="">Fixed 3</a></li>

This is part from the menu.

I meant this is link from my template menu. I have integreted gallery by making custom footer and header. Now I need to put php code to template.

Ok. Where to put code You wrote?:>
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #15 on: December 28, 2006, 01:50:30 pm »

As suggested: edit themes/yourtheme/theme.php as you see fit. There are loads of threads on this sub-board that deal with modifying the coppermine menus. Pay particular attention to the sticky threads.
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #16 on: December 28, 2006, 02:53:28 pm »

Ok. But I think You don't understand me a bit:)

Ok. Here we go.
This is my template.html file:

Code: [Select]
<html>
<head>
[i]MY header HERE[/i]
<script type="text/javascript" src="scripts.js"></script>
<!-- $Id: template.html 2688 2005-12-04 03:22:35Z donnoman $ -->
</head>
<body>

<div id="container">

<div id="logo">
[i]MY logo HERE[/i]
</div>


<div id="menu">
[i]MY MENU HERE[/i]

</div>


</div>
  <table width="100%" border="0" cellpadding="20" cellspacing="20">
    <tr>
      <td valign="top" style="background-color:transparent;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="100%" align="center">
              <h1>{GAL_NAME}</h1>
              <h3>{GAL_DESCRIPTION}</h3><br />
              {SYS_MENU} <br /> {SUB_MENU}
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" valign="top">
              {LANGUAGE_SELECT_FLAGS}
            </td>
          </tr>
          <tr>
            <td align="center" valign="top">
              {THEME_SELECT_LIST}
              {LANGUAGE_SELECT_LIST}
            </td>
          </tr>
        </table>
        <img src="http://michael-schenker.com/images/spacer.gif" width="1" height="15" alt="" />
        <br />
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="left" valign="top">
              {ADMIN_MENU}
              {GALLERY}
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>

<div id="footer">
[i]MY FOOTER HERE[/i]
</div>





</div>
</body>



Ok. Correct me if I'm thinking bad. Is it good way to integrate gallery with my site?

Main question:
My menu works perfectly on main page. But When I have integrated gallery with my site I have lost possibility to use php. I tried to define {TAG} in theme.php but I got DOUBLE_ARROW [or something similar] error. I just want to modify my header menu, not menu from coppermine. I only want to define just one tag:) This damned lang;)

Hope now You understand me;) [or I don't understand You;)]
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP problem
« Reply #17 on: December 28, 2006, 06:09:55 pm »

You can't use PHP in template.html, that's why anything PHPish needs to go into theme.php. So basically, you might do as suggested and add a custom placeholder token (the stuff in curly brackets). You then have to define the content that is suppossed to replace the placeholder token as the theme is being parsed by modifying the pageheader function. If you're not sure how to accomplish this, then zip your custom theme and attach it to your next posting (using "additional options" when composing your message) and I'll look into it.

However, what you're up to do is exactly what the {CUSTOM_HEADER} token is suppossed to do - you can specify a path to your custom include file (that would include your overall site navigation in your case) for that very purpose in Coppermine's config. Take a look at our demo - basically that's what I did there with the blue overall menu and the advanced theme and languages selectors.

As I suggested though: the code you posted wouldn't do anything, it's just wishful thinking. Not related to Coppermine, but to how PHP works - yours just isn't proper PHP syntax, so it won't do what you expect it to do.
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #18 on: December 28, 2006, 07:30:12 pm »

You can't use PHP in template.html, that's why anything PHPish needs to go into theme.php. So basically, you might do as suggested and add a custom placeholder token (the stuff in curly brackets). You then have to define the content that is suppossed to replace the placeholder token as the theme is being parsed by modifying the pageheader function. If you're not sure how to accomplish this, then zip your custom theme and attach it to your next posting (using "additional options" when composing your message) and I'll look into it.

However, what you're up to do is exactly what the {CUSTOM_HEADER} token is suppossed to do - you can specify a path to your custom include file (that would include your overall site navigation in your case) for that very purpose in Coppermine's config. Take a look at our demo - basically that's what I did there with the blue overall menu and the advanced theme and languages selectors.

As I suggested though: the code you posted wouldn't do anything, it's just wishful thinking. Not related to Coppermine, but to how PHP works - yours just isn't proper PHP syntax, so it won't do what you expect it to do.


Could You write somethink how to set custom header? I did it wrong way. Hmmm...it would be enough. Custom header and custom footer :-\
Logged

pedro84

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: PHP problem
« Reply #19 on: December 28, 2006, 07:49:01 pm »

Problem solved  ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 20 queries.