Putting PHP code in template.html and skinning problem Putting PHP code in template.html and skinning problem
 

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]

Main Menu

Putting PHP code in template.html and skinning problem

Started by HCP, April 02, 2006, 08:59:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HCP

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).

Joachim Müller

Quote from: HCP 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?
You can't have php in template.html. Use anycontent or custom header/footer (refer to docs for details).

Quote from: HCP on April 02, 2006, 08:59:59 AMI 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.

HCP

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

http://www.hermitcrabparadise.com/photos/

HCP


ForzaInter

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

HCP

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?

Stramm

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


ForzaInter

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? ???

Joachim Müller

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

ForzaInter


Joachim Müller

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:
Quote from: GauGau on April 05, 2006, 06:23:41 PM
Does the JavaScript section in the <head> section have to use PHP?

ForzaInter

#12
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} ?

Joachim Müller

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.

ForzaInter

Ok, here it is:

<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>

Joachim Müller

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

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


Option 2:
edit script.js and add 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

ForzaInter


Joachim Müller

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.

ForzaInter

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

ForzaInter

Ok, i've uploaded template.html . Check to see how it looks ???