coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: HCP on April 02, 2006, 08:59:59 AM

Title: Putting PHP code in template.html and skinning problem
Post by: 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?

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).
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller on April 02, 2006, 12:02:53 PM
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.
Title: Re: Putting PHP code in template.html and skinning problem
Post by: HCP on April 02, 2006, 12:50:27 PM
EDIT: The site is finally back up again. :-\

http://www.hermitcrabparadise.com/photos/ (http://www.hermitcrabparadise.com/photos/)
Title: Re: Putting PHP code in template.html and skinning problem
Post by: HCP on April 05, 2006, 01:30:33 PM
It's up and running again now.
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter 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
Title: Re: Putting PHP code in template.html and skinning problem
Post by: HCP 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?
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Stramm on April 05, 2006, 05:17:22 PM
when I do a search for 'anycontent' I get 16 pages with results
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller on April 05, 2006, 05:55:34 PM
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#changing
http://forum.coppermine-gallery.net/index.php?action=search2;search=anycontent
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter 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? ???
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller 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
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 05, 2006, 06:30:30 PM
Do i leave these <h1>{GAL_NAME}</h1> as is?
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller 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:
Quote from: GauGau on April 05, 2006, 06:23:41 PM
Does the JavaScript section in the <head> section have to use PHP?
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter 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} ?
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller 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.
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 07, 2006, 02:33:41 PM
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>
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller 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</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
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter 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:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg125.imageshack.us%2Fimg125%2F2078%2Ftable1xn.th.png&hash=ccf7886fb9045269f9424b2dfb86298ddfee059a) (http://img125.imageshack.us/my.php?image=table1xn.png)

Beneath, there are the gallery tables
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller 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.
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 07, 2006, 10:03:12 PM
No, i work the file offline, in my pc. I'll upload it and report back
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 08, 2006, 05:01:57 PM
Ok, i've uploaded template.html . Check to see how it looks ???
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller on April 09, 2006, 10:28:53 AM
The images that are suppossed to be pre-loaded (triggered by the onload event of the body tag) don't exist where the script expects them to be. You apear to be using Dreamweaver as an editor. You have to understand the relative paths to other resources mustn't be seen from the theme folder, but from the coppermine root folder.
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 09, 2006, 04:33:20 PM
I see...But still the positioning is messed up. The boxes down, before the gallery tables start, are supposed to be the image links, just like in the http://www.trivial-fun.gr/  ??? ???
Title: Re: Putting PHP code in template.html and skinning problem
Post by: ForzaInter on April 11, 2006, 02:15:52 AM
I think you forgot me here ::) Plz help! ???
Title: Re: Putting PHP code in template.html and skinning problem
Post by: Joachim Müller on April 11, 2006, 07:50:41 AM
actually no. If you need complicated JavaScript stuff, you're on your own. At least when it comes to me. I simply don't want to look into this, as it is not related to coppermine, but custom modifications that deal with html, JavaScript, CSS.