Article

eZ publish: PHP's Killer App - Parts 1-3

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Next

Anyway, back to business. Some of the variables used in frame.php are described at http://doc.ez.no/article/articleview/204/1/54/. To cut a long story short, here's the sampler file you saw earlier applied to frame.php. Note that I haven't literally copied and pasted everything. In particular, the left menu needs more work, which I'll get to when we look at the eZ article module.

<!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" xml:lang="no" lang="no">        
       
<head>        
<title><?php        
// set the site title        
       
$SiteTitle = $ini->read_var( "site", "SiteTitle" );        
       
if ( isset( $SiteTitleAppend ) )        
   print( $SiteTitle . " - " . $SiteTitleAppend );        
else        
   print( $SiteTitle );        
       
?></title>        
       
       
<?php        
       
// check if we need a http-equiv refresh        
if ( isset( $MetaRedirectLocation ) && isset( $MetaRedirectTimer ) )        
{        
   print( "<META HTTP-EQUIV=Refresh ".        
        "CONTENT=\"$MetaRedirectTimer; URL=$MetaRedirectLocation\" />" );        
}        
       
?>        
       
<link rel="stylesheet" type="text/css"          
   href="<?          
       print $GlobalSiteIni->WWWDir;          
       ?>/sitedesign/<?        
           print ($GlobalSiteDesign);          
                       ?>/style.css" />        
       
<script language="JavaScript1.2">        
<!--//        
       
  function MM_swapImgRestore()        
  {        
     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_preloadImages()        
  {        
     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_findObj(n, d)        
  {        
     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);        
     return x;        
  }        
       
  function MM_swapImage()        
  {        
     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];        
     }        
  }        
       
//-->        
</script>        
       
<!-- set the content meta information -->        
       
<meta name="author" content="<?php        
       
   $SiteAuthor = $ini->read_var( "site", "SiteAuthor" );        
   print( $SiteAuthor );        
       
?>" />        
<meta name="copyright" content="<?php        
       
   $SiteCopyright = $ini->read_var( "site", "SiteCopyright" );        
   print( $SiteCopyright );        
       
?>" />        
<meta name="description" content="<?php        
       
if ( isset( $SiteDescriptionOverride ) )        
{        
   print( $SiteDescriptionOverride );        
}        
else        
{        
   $SiteDescription = $ini->read_var( "site", "SiteDescription" );        
   print( $SiteDescription );        
}        
       
?>" />        
<meta name="keywords" content="<?php        
if ( isset( $SiteKeywordsOverride ) )        
{        
   print( $SiteKeywordsOverride );        
}        
else        
{        
   $SiteKeywords = $ini->read_var( "site", "SiteKeywords" );        
   print( $SiteKeywords );        
}        
       
?>" />        
<meta name="MSSmartTagsPreventParsing" content="TRUE" />        
       
<meta name="generator" content="eZ publish" />        
       
</head>        
       
<body bgcolor="#FFFFFF" topmargin="6"        
   marginheight="6" leftmargin="6" marginwidth="6">        
       
<table width="100%" border="0" cellspacing="0" cellpadding="0">        
<tr>        
<td class="sitetitle">phpPoint.com</td>        
</tr>        
</table>        
       
<table width="100%" border="0" cellspacing="6" cellpadding="6">        
<tr valign="top">        
<td width="15%" class="menuback">        
       
<!-- Left menu start -->        
       
<?        
$CategoryID = 0;        
include( "ezarticle/user/menubox.php" );        
?>        
       
<br />        
       
<table class="menu">        
<tr>        
<td class="menuitem">        
<a href="?PrintableVersion=enabled">Printable page</a>        
</td>        
</tr>        
<tr>        
<td class="menuitem">        
<a target="_blank" href="http://developer.ez.no">        
<img src="<?        
      print $GlobalSiteIni->WWWDir;        
    ?>/images/powered-by-ezpublish-100x35-trans-lgrey.gif"        
      width="100"        
      height="35" border="0" alt="Powered by eZ publish" /></a>        
</div>        
</td>        
</tr>        
</table>        
       
<!-- Left menu end -->        
       
</td>        
<td width="95%">        
       
<!-- Main content view start -->        
       
  <?        
  print( $MainContents );        
  ?>        
       
<!-- Main content view end -->        
</td>        
</tr>        
</table>        
       
<?        
// Store the statistics with a callback image.        
// It will be no overhead with this method for storing stats        
//        
       
$StoreStats = $ini->read_var( "eZStatsMain", "StoreStats" );        
       
if ( $StoreStats == "enabled" )        
{        
   // create a random string to prevent browser caching.        
   $seed = md5( microtime() );        
   // callback for storing the stats        
   $imgSrc = $GlobalSiteIni->WWWDir . "/stats/store/rx$seed-" .        
               $REQUEST_URI . "1x1.gif";        
   print( "<img src=\"$imgSrc\" height=\"1\"".        
          " width=\"1\" border=\"0\" alt=\"\" />" );        
}        
       
?>        
       
</body>        
</html>

With that code in place, copy the style.css file from the sample ZIP to [ezpublish_root]/sitedesign/phppoint and have a look! This is the first version of frame.php. You'll make some more changes later, but for now, that's enough for us to see how the new design looks within eZ publish.

As a side note, one other thing that's been snuck in here is XHTML. It looks very similar to HTML, but has to conform to the rules of "well formed" XML. For example, <img src="myimage.png"> in HTML is <img src="myimage.png" /> in XHTML.

If you liked this article, share the love:
Print-Friendly Version Suggest an Article

Sponsored Links