Including custom header and footer: body and head tags removed Including custom header and footer: body and head tags removed
 

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

Including custom header and footer: body and head tags removed

Started by flapane, September 09, 2014, 12:06:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

flapane

{CUSTOM_HEADER} is a .php header that contains, among other things, </head> and <body> tags.
{CUSTOM_FOOTER} is a .php footer that contains, among other things, </body> tag.
However, everything is included but those tags (check the link in my signature).

Template.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>{TITLE}</title>
{META}

<link rel="shortcut icon" href="favicon.ico" /> 
{JAVASCRIPT}
<script language="JavaScript" type="text/JavaScript">
<!--
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</script>

<link rel="stylesheet" href="themes/wooden/style.css" type="text/css" />
<link rel="stylesheet" href="css/coppermine.css" type="text/css" />

{CUSTOM_HEADER}

<div id="content">
<div class="thin">
  <div class="main_column_altra">
<div class="box" id="recommended">
<div class="head colhead_dark">
<h1>{GAL_NAME}</h1></div>
</div>

<div class="box">
  <div class="pad">
<div align="center"><h3>{GAL_DESCRIPTION}</h3></div>
<div id="MENUS">
  <div id="SUB_MENU">
    {SUB_MENU}
  </div>
  <div id="SYS_MENU">
    {SYS_MENU}
  </div>
</div>
{MESSAGE_BLOCK}
<div id="GALLERY">
  {ADMIN_MENU}
  {GALLERY}
  {LANGUAGE_SELECT_FLAGS}
</div>


  </div>
</div>

</div>
</div>

{CUSTOM_FOOTER}

</html>


Any hints?
Thanks in advance
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

Please have a look at the function cpg_get_custom_include in include/functions.inc.php:
    $return = str_replace('<html>', '', $return);
    $return = str_replace('<head>', '', $return);
    $return = str_replace('<body>', '', $return);
    $return = str_replace('</html>', '', $return);
    $return = str_replace('</head>', '', $return);
    $return = str_replace('</body>', '', $return);

flapane

Thanks for your help André.
Of course I can edit the file after every upgrade, but please would you consider adding an option in the control panel to deliberately let those tags appear in the custom includes? A sort of "developer option".
I know those tags shouldn't be there but...  :)
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

No need for a new option IMHO (however such option should look like and triggered), as you can adjust your theme to don't use that function. Please search for cpg_get_custom_include in themes/sample/theme.php, you'll find it in pageheader(), pagefooter() and pageheader_mini() (currently not sure where the last function is used). Then, replace cpg_get_custom_include with a custom function (e.g. copy cpg_get_custom_include to your theme.php file, rename it to something like cpg_get_custom_include_custom and remove the parts you don't need).

flapane

I'm sorry, but I'm not sure I got it.
If I rename cpg_get_custom_include function, I'll of course get a "call to undefined function" error.
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

Quote from: Αndré on September 10, 2014, 11:31:02 AM
copy cpg_get_custom_include to your theme.php file, rename it to something like cpg_get_custom_include_custom and remove the parts you don't need

flapane

Of course... I don't know what I was doing and why. Sorry, I had a tough day.
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com