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] 2   Go Down

Author Topic: Putting PHP code in template.html and skinning problem  (Read 13127 times)

0 Members and 1 Guest are viewing this topic.

HCP

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
    • Hermit Crab Paradise
Putting PHP code in template.html and skinning problem
« on: April 02, 2006, 08:59:59 am »

I want to put some PHP layout includes into template.html. Is this possible? If not, what alternative ways can I use?

I am making my own theme called HCP on my photo gallery, and it is based on the Classic theme. I have these weird blank spots on my theme though (see the first image), and I can't change the scrollbar colours. The theme uses two CSS files (one for the whole site and one for the gallery only). The scrollbar colours are set in the entire site stylesheet (format.css), but they aren't showing. Also, the gallery stylesheet is adding some extra spacing above and below the date and time (see the second image).
« Last Edit: April 02, 2006, 09:26:38 am by HCP »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #1 on: April 02, 2006, 12:02:53 pm »

I want to put some PHP layout includes into template.html. Is this possible? If not, what alternative ways can I use?
You can't have php in template.html. Use anycontent or custom header/footer (refer to docs for details).

I am making my own theme called HCP on my photo gallery, and it is based on the Classic theme. I have these weird blank spots on my theme though (see the first image), and I can't change the scrollbar colours. The theme uses two CSS files (one for the whole site and one for the gallery only). The scrollbar colours are set in the entire site stylesheet (format.css), but they aren't showing. Also, the gallery stylesheet is adding some extra spacing above and below the date and time (see the second image).
post a link to your site. In the future, please respect the "one question per thread" policy.
Logged

HCP

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
    • Hermit Crab Paradise
Re: Putting PHP code in template.html and skinning problem
« Reply #2 on: April 02, 2006, 12:50:27 pm »

EDIT: The site is finally back up again. :-\

http://www.hermitcrabparadise.com/photos/
« Last Edit: April 03, 2006, 09:38:32 am by HCP »
Logged

HCP

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
    • Hermit Crab Paradise
Re: Putting PHP code in template.html and skinning problem
« Reply #3 on: April 05, 2006, 01:30:33 pm »

It's up and running again now.
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #4 on: April 05, 2006, 01:54:08 pm »

Hello from me, i'm new. Congratulations to your efforts! :)

I'd like to do about the same thing with my site. The url: http://www.trivial-fun.gr and the gallery http://www.trivial-fun.gr/gallery/index.php

I want the gallery to be inside the content, like in the home page. Do i have to alter the code inside index.php? Can i do the "integration"(is this the right word?) only by changing the style.css from the default theme?

Thank you
Logged

HCP

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
    • Hermit Crab Paradise
Re: Putting PHP code in template.html and skinning problem
« Reply #5 on: April 05, 2006, 03:36:24 pm »

Actually, my question hasn't been solved yet.

How do I enable anycontent.php if that's what I need to do? Where do I put the paths for the PHP includes in anycontent.php?
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Putting PHP code in template.html and skinning problem
« Reply #6 on: April 05, 2006, 05:17:22 pm »

when I do a search for 'anycontent' I get 16 pages with results

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #8 on: April 05, 2006, 06:21:52 pm »

There is javascript running for my header, for the rollovers, and it's in <head>. This means i can't add this header into the gallery?

My footer has an outer .css. What about this? ???
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #9 on: April 05, 2006, 06:23:41 pm »

edit your theme accordingly. Does the JavaScript section in the <head> section have to use PHP? If not, just add your custom JavaScript to themes/yourtheme/template.html
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #10 on: April 05, 2006, 06:30:30 pm »

Do i leave these <h1>{GAL_NAME}</h1> as is?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #11 on: April 06, 2006, 06:57:35 am »

You're free to move them around, delete them or change the html they're wrapped in. The tokens in curly brackets are placeholders that get replaced with actual content when your coppermine site is being accessed. The token you chose as an example just will display the name of your gallery that you have set up in coppermine's config. You can safely delete it. There are tokens though that are mandatory to keep, especially the {GALLERY} token that will be replaced by the actual content of your coppermine-driven page. You could get rid of the menu tokens as well, but then you'll lose all menus of course, which is not a desirable thing. I suggest experimenting with it: remove/move/format one token at a time, upload the modified file and see how your gallery looks. If you screw it up, go back (undo your changes).

Please answer my question:
Does the JavaScript section in the <head> section have to use PHP?
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #12 on: April 06, 2006, 09:09:45 pm »

Sorry, didn't see it ::)

No, i don't think so. If it is so, i would see PHP code, wouldn't i?

When i insert the header and the footer in file template.html, all the rest of the <h1>{GAL_NAME}</h1> things are lost ??? Do i have to erase the {CUSTOM_HEADER} and {CUSTOM_FOOTER} ? What is {VANITY} after {CUSTOM_FOOTER} ?
« Last Edit: April 06, 2006, 09:32:09 pm by ForzaInter »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #13 on: April 07, 2006, 07:47:20 am »

let's solve one question at a time. Post the JavaScript code you want to add in first. I can then tell you were to add it exactly.
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #14 on: April 07, 2006, 02:33:41 pm »

Ok, here it is:

Code: [Select]
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #15 on: April 07, 2006, 04:32:09 pm »

no PHP in this, just plain JavaScript.
There are two option to add this then:

Option 1:
edit themes/yourtheme/template.html, find
Code: [Select]
</head>and add before it (into a new line) the code you posted


Option 2:
edit script.js and add
Code: [Select]
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
into a new line at the very end of the file
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #16 on: April 07, 2006, 06:20:47 pm »

In the second case, the gallery tables dissappear... ???

In the first case, the header is split and it's like that:
(http://img125.imageshack.us/img125/2078/table1xn.th.png)

Beneath, there are the gallery tables
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Putting PHP code in template.html and skinning problem
« Reply #17 on: April 07, 2006, 09:47:08 pm »

http://www.trivial-fun.gr/gallery/index.php looks as expected. You're probably running this on another page. Post a link, a screenshot doesn't help at all.
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #18 on: April 07, 2006, 10:03:12 pm »

No, i work the file offline, in my pc. I'll upload it and report back
Logged

ForzaInter

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Putting PHP code in template.html and skinning problem
« Reply #19 on: April 08, 2006, 05:01:57 pm »

Ok, i've uploaded template.html . Check to see how it looks ???
Logged
Pages: [1] 2   Go Up
 

Page created in 0.024 seconds with 19 queries.