PDA

View Full Version : using empty.php for own pages with test information


PeterTaylor
11th of October 2006 (Wed), 08:31
Hi Pekka,

I have used the file empty.php to create a links page, order information pahe and copyright information page. But when I link to these pages they do not follow the style of the rest of the site, i.e. they are just plain black text on a white page. I used the file empty.php believing it was the EE2 version of plane.php from EE1.5.

I am probably missing something simple somewhere, any help would be appreciated.

Thanks
Peter

Pekka
12th of October 2006 (Thu), 14:22
1. empty.php uses Global style.
2. empty.php has been set to use content_a.php template.

So, edit the style you have defined as Global Style, and set "Custom A content" path to

templates/pages/ee_2_default/custom/content_a.php

and save the style. Make sure the path points to correct file (and that the file is there). Now empty.php outputs pages using content_a.php template. You do need a template variable(s) for printing the content, though. If you use sevaral empty.php's (renamed of course) it might be easiest to add the content in them all as


ob_start();

// content here

$custom_content_html = ob_get_contents();
ob_end_clean();


and then add a print command in content_a.php

print $custom_content_html;

So that you do not have to add templates for each file (I'll write adding templates to style editor tutorial soon).

Here are the demo files:

empty.php with some demo content as "$custom_content_html" variable :


<?php
error_reporting(0);
$toroot = "./";
$currentpage = "custom_a";
$this_is_index = "1";
ob_start ("ob_gzhandler");
@include ("./basecode/SCRIPT_slashwork.php");
@include ("./basecode/SECURITY_datacleaner.php");
@include ("./basecode/SETUP_settings.php");
@include ("./basecode/SCRIPT_connect.php");
@include ("./basecode/SCRIPT_uncookied.php");
$uncookied_base_id = "";
if (isset($_POST['u'])) {
$u = ee_datacleaner($_POST['u']);
ee_uncookied_update_log ($u);
if ($u=="") $u = 1;
ee_uncookied_extract ($u); // now we have all post variables back
}
if (isset($_GET['u'])) {
$u = ee_datacleaner($_GET['u']);
ee_uncookied_update_log ($u);
$u = str_replace($uncookied_foochar,"",$u);
$vartalo = explode($uncookied_splitter,$u);
$u = $vartalo[0];
if ($u=="") $u = 1;
if (isset($vartalo[1])) {
$offset = $vartalo[1];
}
if (ee_uncookied_get_id ($u)) {
ee_uncookied_extract ($u); // now we have all get variables back
} else {
$offset_finder = "1";
}
}
@include ("./basecode/SCRIPT_language.php");

unset($exhibition);
if (isset ($_GET['exhibition'])) {
$exhibition = ee_datacleaner($_GET['exhibition']);
}

@include ("./languages/" . $ee_lang . "/global.php");
@include ("./languages/" . $ee_lang . "/custom.php");

@require ("./basecode/SECURITY_check_user_authorization.php");
@require ("./basecode/SECURITY_check_exhibition_validity.php");
@include ("./basecode/SCRIPT_common_functions.php");
@include ("./basecode/SCRIPT_fetchsettings.php");
@include ("./basecode/SCRIPT_get_styledata.php");
@include ("./basecode/SCRIPT_indexfunctions.php");
@include ("./basecode/SCRIPT_get_structure.php");
$uncookied = array(
"sortby_off" => @$sortby_off,
"sort_row" => @$sort_row,
"order" => @$order,
"search_row" => @$search_row,
"keyword" => @$keyword,
"category" => @$category,
"select_output" => @$select_output,
"size" => @$size,
"exhibition" => @$exhibition,
"perpage" => @$perpage,
"revealforms" => @$revealforms,
"viewall" => @$viewall,
"hidedetail" => @$hidedetail,
"ee_lang" => @$ee_lang
);
$temp = $uncookied;
$uncookied_base_id = ee_uncookied_make ($temp);
@include ("./basecode/SCRIPT_common_items.php");




ob_start();

// content here

?>
<table width="100%" border="0" cellspacing="20" cellpadding="0"><tr><td>

<h2 class="ee_css_header_large ee_css_capitalize">hello world</h2>
<?php

print "<p class=\"ee_css_paragraph\">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla tristique mollis magna. Ut vel ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec et nibh. Suspendisse non neque. Cras vel sem. Quisque pellentesque, ligula quis faucibus gravida, odio augue porttitor justo, at suscipit nulla mauris sit amet arcu. Sed at arcu. Nullam arcu nulla, feugiat sed, convallis ac, bibendum id, ante. Quisque libero lacus, imperdiet ac, blandit in, tempus ac, urna. Sed tristique malesuada pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In fringilla, quam at tempor sodales, nibh felis iaculis neque, eget porta pede pede at tellus. Duis nec elit ac neque placerat malesuada. Duis lacinia malesuada neque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Vestibulum felis.</p>";

?>
</td></tr></table>
<?php
$custom_content_html = ob_get_contents();
ob_end_clean();




ob_start();
@include ("./" . $custom_a_content);
$ee_all_html = ob_get_contents();
ob_end_clean();

if ($s_remove_xhtml_multispaces == "1") {
print preg_replace('/\s\s+/', ' ', $ee_all_html); // remove multispaces
} else {
print $ee_all_html;
}

mysql_close ();
ob_end_flush();
?>



content_a.php which prints "$custom_content_html" variable :



<?php print "<?xml version=\"1.0\" encoding=\"{$charset_code_html}\"?>"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>new page</title>
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php print $charset_code_html; ?>" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="generator" content="Exhibit Engine <?php print $version; ?>" />
<meta name="robots" content="index,follow" />


<link rel="stylesheet" type="text/css" media="screen,projection" href="./stylesheet.php?style_id=<?php print $style_id; ?>&amp;currentpage=<?php print $currentpage; ?>" />


</head>
<body class="ee_css_background">




<?php

print $header_html;
include("./" ."templates/extra_components/vertical_shadow.php"); // shadow

if ($s_on == "0") {
print $s_off_message;
exit();
}







print $custom_content_html;






?>
<div class="navigationfooterholder">
<div class="navigationfooter">
<?php print $footer_html; ?>
</div>
</div>



</body>
</html>