force rowspan not to split other column data in new page - css

Currently i'm working on attendance report generation but now i face this problem i try every css print property but nothing works for me below the css code that i use
#printdata h1,h2,h3,h4,h5,h6{
text-align: center;
line-height: 0.1em;
text-transform: uppercase;
}
#printdata p{
font-size: 20px;
font-weight: bold;
text-align: center;
text-transform: uppercase;
}
#printdata table {
margin-top: 10px;
page-break-after:auto;
width:100%
}
#printdata tr{
page-break-inside: avoid;
-webkit-region-break-inside: avoid;
}
#printdata td{
page-break-inside:avoid;
page-break-after:auto;
padding: 16px 0px;
font-size: 12pt;
}
thead{
display:table-header-group;
}
tfoot{
display:table-footer-group;
}
Here my php code where i use rowspan on column 1 and 2
<tbody>
<?
if(count($this->employees) > 0)
{
$x = 0;
foreach ($this->employees as $key=>$employee)
{
?>
<tr>
<td rowspan="2"><? echo ++$x; ?></td>
<td rowspan="2" align="center"><? echo $employee->ticket_no; ?></td>
<td colspan="2"><? echo $employee->employee_name; ?></td>
<?
for($i=1;$i<=$days_in_month;$i++)
{
?>
<td align="center">
<?
if($employee->in_time[$i] == "" && $employee->out_time[$i] == "" && $employee->minutes_late[$i] == "" && $employee->gate_pass[$i] == "" && $employee->idle_booking[$i] == "" && $employee->minutes_early[$i] == "" && $employee->second_half_cl[$i] == "")
{
echo $employee->attendance[$i];
}
else
{
echo $employee->in_time[$i];
echo ($employee->out_time[$i] != "" ? $employee->out_time[$i] : "");
//echo ($employee->attendance[$i] != "" ? $employee->attendance[$i] : "");
echo ($employee->minutes_late[$i] != "" ? $employee->minutes_late[$i] : "");
echo ($employee->gate_pass[$i] != "" ? ($employee->minutes_late[$i] != "" ? " + " : "") . $employee->gate_pass[$i] : "");
echo ($employee->idle_booking[$i] != "" ? $employee->idle_booking[$i] : "");
echo ($employee->minutes_early[$i] != "" ? $employee->minutes_early[$i] : "");
echo ($employee->second_half_cl[$i] != "" ? $employee->second_half_cl[$i] : "");
//echo ($this->leaves[$i] != "" ? $employee->second_half_cl[$i] : "");
}
?>
</td>
<?
}
?>
<td colspan="2" align="center">A</td>
<td align="center">B</td>
<td colspan="2" align="center">C</td>
</tr>
<tr>
<td><? echo $employee->section; ?></td>
<td><? echo $employee->trade; ?></td>
<?
for($i=1;$i<=$days_in_month;$i++)
{
echo "<td align='center'>";
echo $i;
echo "</td>";
}
?>
<td align="center">1</td>
<td align="center">2</td>
<td align="center">3</td>
<td align="center">4</td>
<td align="center">5</td>
</tr>
<?
}
}
?
</tbody>
This is the result basically i get i just want to forcefully stop spliting rowspan in new page it would be great is its avoid split and print the whole row in new page
For better understanding check below image and any help would be appriciated
https://i.stack.imgur.com/tvkF5.png

Can you see if this works?
printdata table { page-break-inside:auto }
printdata table tr { page-break-inside:avoid;
page-break-after:auto }

Related

I want to make striped color Table in React.js ( I use map function)

Displaying fetched devices data by using the map function but
I can't make striped color Table.
I want to display the background color of the tbody tag in stripes (using Bootstrap)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
React.js
<table className="table table-striped table-bordered">
<thead className="table_thead ">
<tr className="table_font_color">
<th scope="col">Device Name</th>
<th scope="col">Type</th>
<th scope="col">Room</th>
</tr>
</thead>
{entities.map((entity, i) => (
<tbody>
<tr className="table_font_color">
<th scope="row">
<Icon entityKey={entity.key} type={entity.type} state={entity.state} entityID={entity.entity_id} objectID={entity.object_id} />
<p className="">{entity.entity_id}</p>
</th>
<td className="align-middle">
{entity.key === "camera" && <div>Smart Camera</div>}
{entity.key === "cover" && <div>Garage</div>}
{entity.key === "climate" && <div>Smart Themostat</div>}
{entity.key === "lock" && <div>Smart Lock</div>}
{entity.key === "light" && <div>Smart Light</div>}
{entity.key === "sensor" && <div>Sensor</div>}
{entity.key === "switch" && <div>Smart Plug</div>}
</td>
<td className="align-middle table_rightside">
{entity.key === "switch" && <button className="btn btn-primary button_table_rightside">Unassigned</button>}
{entity.key === "sensor" && <button className="btn btn-primary button_table_rightside">Unassigned</button>}
{entity.key === "light" && <div className="table_rightside_p"><p>{entity.room_name}</p><img className="ic_edit_in_table" src={ic_edit} /></div>}
{entity.key === "camera" && <div className="table_rightside_p"><p>{entity.room_name}</p><img className="ic_edit_in_table" src={ic_edit} /></div>}
{entity.key === "climate" && <div className="table_rightside_p"><p>{entity.room_name}</p><img className="ic_edit_in_table" src={ic_edit} /></div>}
{entity.key === "cover" && <div className="table_rightside_p"><p>{entity.room_name}</p><img className="ic_edit_in_table" src={ic_edit} /></div>}
{entity.key === "lock" && <div className="table_rightside_p"><p>{entity.room_name}</p><img className="ic_edit_in_table" src={ic_edit} /></div>}
</td>
</tr>
</tbody>
))};
</table>
CSS
.table_thead {
background-color: #152D58 !important;
}
.table-bordered {
border: none !important;
}
.table-striped > tbody > tr:nth-child(0) > td, .table-striped > tbody > tr:nth-child(0) > th {
background-color: #152D58 !important;
}
.table-striped > tbody > tr:nth-child(2n+1) > td, .table-striped > tbody > tr:nth-child(2n+1) > th {
background-color: #1E3E75 !important;
}
.table-striped > tbody > tr:nth-child(2n) > td, .table-striped > tbody > tr:nth-child(2n) > th {
background-color: #152D58 !important;
}
table.table-bordered > thead > tr > th{
border:3px solid #022055 !important;
}
.table-bordered td {
border:3px solid #022055 !important;
}
.table-bordered th {
border:3px solid #022055 !important;
}
.table_font_color {
color: white !important;
}
Added photo
Use conditional class according to your index in your map method
<tr className={`table_font_color ${i % 2 === 0 ? 'table-striped' : ''}`}>
and then in your css
.table-striped > td {
background-color: #152D58 !important;
}
Using nth-child odd and even you can alternate between the two.
tbody tr:nth-child(odd){
background-color: #111;
color: #fff;
}
tbody tr:nth-child(even){
background-color: #222;
color: #fff;
}
Edit:
Since you are using map, you can get access to index in map and check whether it's odd or even. Based on that you can add a class and modify css accordingly.
map((element, index) => {
return <TableRow
class = {index % 2 !== 0 ? "odd-row" : "even-row"}
/>
});

How to display an ACF checkbox value in MPDF?

I have been working with mpdf and acf to generate a pdf. I can generate the pdf and display text values but I can't get it to display the values of a checkbox, it displays nothing.
This is the code that I have, what am I doing wrong? How do I get it to display something for the checkbox?
$offer is the checkbox that I am trying to display.
add_action('init', 'congres_redirect');
function congres_redirect() {
if(isset($_GET['offer'])) {
global $post; //ADD THIS
$offerid = $_GET['offer'];
$restname = get_field('restaurant_name', $offerid);
$offer = get_field_object('restaurant_offer', $offerid);
if( in_array( '2courses10', $offer ) or '2courses10' == $offer ) { $offer2for10='2 courses for 10'; }
$randNum = strtoupper(generateRandomString(5));
$date = date("Ymd");
$namecode = strtoupper(str_replace(' ', '', $restname));
$namestr = substr($namecode, 0, 6);
view_conferinta($restname, $randNum, $date, $namecode, $namestr);
}
}
function view_conferinta($restname, $randNum, $date, $namecode, $namestr) {
global $post;
$output = '<html>
<head><title>'.$restname.' | Eat Leeds</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>
<body style="font-family:chelvetica;">
<table class="voucher-content" width="100%">
<tr>
<td width="60%"></td>
<td width="40%">
<table>
<tr class="inner-voucher">
<td class="offer-details" style="color: #fff !important;">'.$restname.'</td>
</tr>
<tr class="inner-voucher">
<td class="offer-details" style="color: #fff !important;">'.$offer2for10.'</td>
</tr>
<tr>
<td style="vertical-align: top; padding-top: 20px; padding-left: 280px; color: #fff;"><div class="vouchercode">Voucher Code: EL-'.$namestr.''.$date.'-'.$randNum.'</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>';
require_once __DIR__ . '/mpdf/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf(['debug' => true]);
$mpdf->WriteHTML($output);
$mpdf->Output('eatleeds-EL-'.$namestr.''.$date.'-'.$randNum.'.pdf','I');
exit;
}
You did not set a default value for $offer2for10.
You could also use a switch and loop into $offer value:
switch ($offer) {
case '2courses10':
$offer2for10 = "2 courses for 10";
break;
default:
$offer2for10 = "Unknown offer";
break;
}

How to implement CSS to powershell conver to html Output?

I have found interesting code that highlights a rows in table if the output is not desired
Source - https://www.youtube.com/watch?v=QdK3qM5jnYw&feature=youtu.be
$headLinkcheck += #'
<style>
body
{
background-color:white;
font-family:Arial;
font-size:8pt;
}
td,th
{
border:1px solid black;
border-collapse:collapse;
}
th
{
color:white;
background-color:black;
}
table, tr, td, th {padding:5px; margin: 0px;}
table {margin-left:50px;width: 80%;height:35%}
.danger {background-color:yellow;font-weight:bold}
.warn {background-color:blue}
</style>
'#
Ok now i have code that checks webistes and their status
function GetSiteStatus(){
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[hashtable]$WebSiteInfo
)
process{
$Response = New-Object System.Collections.ArrayList
$WebSiteInfo.GetEnumerator() | %{
$Item = $_
try{
$status = Invoke-WebRequest -Uri $_.Value | %{
if(#('404','503','403') -match $_.StatusCode){
"$($Item.Key) The Site may be down, please check. - status is $($_.StatusCode)"
}else{
"OK"
}
}
$Response.Add([PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value)}) | out-null
}catch{
$Status = "$($Item.Key), $_."
$Response.Add([PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value)}) | out-null
}
}
return $Response
}
}
$html_url1 = #{
"Calendar" = "http:/";
} | GetSiteStatus | ConvertTo-Html -Head $headLinkcheck -Property Name,Value,Status,#{Label="Link";Expression={"<a href='$($_.Value)'>$($_.Name)</a>"}}
Add-Type -AssemblyName System.Web
[System.Web.HttpUtility]::HtmlDecode($html_url) | Out-File "\\servertest\xpbuild$\IT\Level0\scresult\servicecheck$global:servicecheckdate.htm" -Append # have to use it to creates clickable links
Now the last piece is second part of code which i found ,that checks each line in rows -theorically
[array]$html_url += $html_url1 i quess this might help code below to read values
[xml]$html = $html_url | ConvertTo-Html -Fragment
for ($i = 1; $i -le $html.table.tr.Count-1;$i++){
$class = $html.CreateAttribute("class")
if(($html.table.tr[$i].td[-1]) -ne "OK"){
$class.Value = "danger"
$html.table.tr[$i].attributes.append($class) | Out-Null
}
}
$body += #"
$($html.innerxml)
"#
Now the problem with this is i am not sure how to implement this last part to my code
I got variable- $html_url1 that contains all needed values from my function that checks webistes.
I am not sure how to add this piece - should I add it to my $html_url1 pipe? I tried and it fails. Can you suggest hopw to implement this ?
You can always just make the page from scratch and build whatever you want from there an example
$Sites = #{
"Google"="http://google.com";
"ErrorTest"="I Am Fake";
"Yahoo" = "http://Yahoo.com";
}
$OutFile = "C:\Test\Test.htm"
function GetSiteStatus(){
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline)]
[hashtable]$WebSiteInfo
)
process{
$WebSiteInfo.GetEnumerator() | %{
$Item = $_
$Type
try{
$status = Invoke-WebRequest -Uri $_.Value | %{
if(#('404','503','403') -match $_.StatusCode){
"$($Item.Key) The Site may be down, please check. - status is $($_.StatusCode)"
$Type = "Warning"
}else{
"OK"
$Type = "Good"
}
}
return [PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value); "Type"=$Type}
}catch{
$Type = "Error"
$Status = "$($Item.Key), $_."
return [PSCustomObject]#{"Name"= $Item.Key; "Value"=$Item.Value; "Status"=$Status; "Link"=$($Item.value); "Type"=$Type}
}
}
}
}
$HTML = #"
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
body{
background-color:white;
font-family:Arial;
font-size:8pt;
}
td,th{
border:1px solid black;
border-collapse:collapse;
}
th{
color:white;
background-color:black;
}
table, tr, td, th {
padding:5px;
margin: 0px;
}
table {
margin-left:50px;
width: 80%;
height:35%
}
.Warning {
background-color:yellow;
font-weight:bold
}
.Error {
background-color:#d9534f;
color:#ffffff;
}
</style>
</head>
<body>
<table>
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Value</th>
<th>Status</th>
<th>Link</th>
</tr>
$($Sites | GetSiteStatus | %{
$item = $_
switch($_.Type){
"Good" {
"<tr class='Good'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($item.Name)</a></td></tr>"
}
"Warning" {
"<tr class='Warning'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($_item.Name)</a></td></tr>"
}
"Error" {
"<tr class='Error'><td>$($item.Name)</td><td>$($item.Value)</td><td>$($item.Status)</td><td><a href='$($item.Value)'>$($item.Name)</a></td></tr>"
}
}
})
</tbody>
</table>
</body>
</html>
"# | out-file $OutFile

CSS media prints 3 blank pages

I use Bootstrap 3, just to know. I cannot get rid of 3 blank pages after the first one. Don t know what is causing this problem.
HTML:
<table class="table table-bordered table-hover text-center" id="post_accesorii">
<thead>
<tr>
<th>Cod</th>
<th>Denumire</th>
<th>Cantitate</th>
<th>U.M.</th>
</tr>
</thead>
<tbody>
<form method="post" action="" autocomplete="off">
<?php
while($rowD = mysqli_fetch_assoc($query)) {
foreach ($rowD as $col => $val) {
if($val != "" && $val != "0" && $col != "nr_fisa" && $col != "id") {
$findum = mysqli_query($mysqli, "SELECT * FROM `stocuri` WHERE `cod` = '$col' AND `post1` = 'Accesorii'") or die(mysqli_error($mysqli));
$rowum = mysqli_fetch_array($findum);
echo "<tr class='piesa_folosita'>";
if($col == $rowum['cod'])
{
echo "<td>" . $col . "</td>";
echo "<td>" . $rowum['denumire'] . "</td>";
echo "<td>" . $val . "</td>";
echo "<td>" . $rowum['um'] . "</td>";
}
echo "</tr>";
} else {
}
}
}
?>
</tbody>
<tfoot>
<tr>
<th>Cod</th>
<th>Denumire</th>
<th>Cantitate</th>
<th>U.M.</th>
<tr>
</tfoot>
</table>
PRINT
print.css:
#media print {
html, body {
visibility: hidden;
height: 99% !important;
}
#post_accesorii, #post_accesorii * {
visibility: visible;
height: 99% !important;
}
#post_accesorii+#post_accesorii {
page-break-before: always;
}
}
In print preview, I have 3 blank pages after the first page with my table. I tried several solutions to remove them but none worked.
What can be the problem?
Your height: 99% !important; might be the problem, because the <body/> does not have parent
Your last print rule implies that there is more than one element that has the ID #post_accesorii . This should not be the case and is invalid HTML: IDs must only appear once in a page. So maybe that's the reason for your problems (I don't know what is around the code you posted, so that's all I can say).
To avoid that, make it a class instead of an ID: .post_accesorii and assign that to the HTML table tag/s via <table class="post_accesorii">

Installing existing site Navigation into blog script?

You will probably consider me a spoil sport for not working with wordpress for this purpose.
However I just want to use a flatfile blog system for a small site. I am using ozjournals-3.2 blog system.
I am seeking to install a header and a site navigation at the top of the blog page so that it coordinates with the existing site. I have had some success with the header but the navigation is making me struggle! I want navigation to position underneath the header as attached image demonstrates. Currently the task is presenting two problems that i need to find a work around for:
Nav will not center on page but keeps left even when I margin:auto; ?
Cannot get it to position at the foot of the header image!
My nav css is as follows:
.nav {
width: 950px;
float: left;
margin: 0 0 1em 0;
padding: 0;
background-color: #3b3b44; /*Navigation Active Background*/
border-top: 1px solid #ccf;
border-bottom: 1px solid #ccf;}
.nav ol {
list-style: none;
width: 950px;
margin: 0 auto;
padding: 0; }
.nav li {
float: left; }
.nav li a {
display: block;
padding: 2px 20px;
text-decoration: none;
font-family: Helvetica, arial, sans-serif;
font-size: 16px;
font-weight: bold;
color: #fff; /*Active Text Color*/
border-right: 1px solid #ccf; }
.nav li:first-child a {
border-left: 0px solid #ccf; }
.nav li a:hover {
color: #000; /*Active Hover Color*/
background-color: #8db3ff; } /*Navigation Hover Background*/
#header {
height: 185px;
margin-top: 15px;
background: url(zitemplateChange.jpg);
border-bottom: 30px solid #cc0; /*showing where I want navigation to position*/
}
and the index.php
<!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>
<link rel="stylesheet" href="themes/default/zitemplateChange.css" type="text/css" media="screen" />
</head>
<body>
<div class="nav">
<ol>
<li>Home</li>
<li>About</li>
<li>Book Preview</li>
<li>Guestbook</li> <li>Tell a Friend</li>
<li>Contact</li>
<li>Support</li>
</ol>
</div>
<?php
/********************************************************************************************************
OZJournals Version 3.2 released by Online Zone <https://sites.google.com/site/onlinezonejournals>
Copyright (C) 2006-2011 Elaine Aquino <elaineaqs#gmail.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option)
any later version.
********************************************************************************************************/
# For the session
ob_start();
# For function file inclusion
include "functions.php";
# For language file inclusion
$langfile = file_get_contents("lang/index.php");
$eachlang = explode("\t", $langfile);
$oklang = $eachlang[1];
$uselang = file_get_contents("lang/$oklang.php");
$lang = explode("\n", $uselang);
# Clean the GET variablezzz
$clean['show'] = string_filter_nospace($_GET['show']);
$clean['id'] = int_filter($_GET['id']);
$clean['p'] = string_filter_nospace($_GET['p']);
$clean['f'] = int_filter($_GET['f']);
$clean['pn'] = int_filter($_GET['pn']);
# Printer-friendly view
if($clean['show'] == "printpreview") {
if(isset($clean['id'])) {
$id = super_filter($clean['id']);
if(file_exists("$datadirectory/$id.php")) {
$pfile = file_get_contents("$datadirectory/$id.php");
$what = explode("\t", $pfile);
die("<html><head><title>$what[1]</title></head><body onload=\"window.print()\"><h1>$what[1]</h1><h5>Posted by $what[4] [ $what[5] ]<br />Date: ".date($timeformat, $what[2])."<br />Category: $what[6]</h5><p>$what[3]</p><h5>Source URL: <script>document.writeln(self.location)</script></h5></body></html>");
}
}
}
# RSS view
if($clean['show'] == "rss") {
die(generaterss());
}
# Theme Picker
$themefile = file_get_contents("themes/index.php");
$eachtheme = explode("\t", $themefile);
$oktheme = $eachtheme[1];
include "themes/$oktheme/advanced.php";
$header = implode(" ", file("themes/$oktheme/header.php"));
$header = str_replace("{blogtitle}", $blogtitle, $header);
$header = str_replace("{subtitle}", subtitle($clean["show"], $clean["p"], $clean["f"]), $header);
$header = str_replace("{metakeywords}", $metakeywords, $header);
$header = str_replace("{metadescription}", $metadescription, $header);
$header = str_replace("{author}", $auth, $header);
//$header = str_replace("{header}", $blogheader, $header);
$header = str_replace("{mainlinks}", $mainlinks, $header);
$header = str_replace("{add-ons}", $addons, $header);
$header = str_replace("{search}", $search, $header);
$header = str_replace("{categories}", $categories, $header);
$header = str_replace("{archives}", $archives, $header);
$header = str_replace("{miscellaneous}", $miscellaneous, $header);
$header = str_replace("{adminmenu}", "", $header);
$header = str_replace("{usermenu}", "", $header);
$header = str_replace("{footer}", $blogfooter, $header);
echo $header;
# Signing out Initial
if($clean['show'] == "signout") {
session_start();
session_destroy();
header("Location: index.php?show=signout2");
}
# Signing out Part 2
if($clean['show'] == "signout2") {
adminpanel("$lang[1]<br /><br />");
}
# Sign-in
elseif($clean['show'] == "signin") {
echo "<h3>$lang[2]</h3>\n";
echo "<form name=\"e\" method=\"post\" action=\"index.php?show=signinok\">\n";
echo "<table border=\"0\">\n";
echo "<tr><td width=\"40%\">$lang[3]</td>";
echo "<td width=\"60%\"><input type=\"radio\" name=\"mode\" value=\"admin\" checked=\"checked\" /> $lang[4] \n";
echo "<input type=\"radio\" name=\"mode\" value=\"user\"> $lang[5] </td></tr>\n";
echo "<tr><td width=\"40%\"> $lang[6] </td>";
echo "<td width=\"60%\"><input type=\"text\" name=\"username\" /></td></tr>\n";
echo "<tr><td width=\"40%\"> $lang[7] </td>";
echo "<td width=\"60%\"><input type=\"password\" name=\"password\" /></td></tr>\n";
echo "</table><br />\n";
echo "<button type=\"submit\"> $lang[8] </button> \n";
echo "<button type=\"reset\"> $lang[9] </button> \n";
echo "</form><br /><br />\n";
}
# Blog
elseif($clean['show'] == "" OR $clean['show'] == "main" OR $clean['show'] == "index") {
$fortitle=$tagline;
$pn = $clean['pn'];
if($total > 0) {
if($total >= $displaynumber) {
if($pn == "") {
$pn = $total;
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
else {
$pn = $clean['pn'];
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
}
else {
echo display ($displaynumber, $datadirectory, $total, $pn);
echo "<p> </p>\n";
}
}
else {
blogviewer("$lang[10]<br />\n\n", $blogtitle);
}
}
# Pages
elseif($clean['show'] == "pages") {
$totalpages = countfiles("pages");
$currentpage = super_filter($clean['f']);
if(file_exists("pages/$currentpage.php")) {
$cc = file_get_contents("pages/$currentpage.php");
$eachcc = explode("\t", $cc);
if($totalpages > 0) {
echo "<h3>".$eachcc[1]."</h3>\n";
echo "<h5>$lang[12] ".$eachcc[4]." $lang[11] ".date($timeformat, $eachcc[2])." </h5>\n";
echo "<p> ".stripslashes($eachcc[3])." </p>\n\n";
}
else {
blogviewer("$lang[13]<br />\n\n", $blogtitle);
}
}
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
}
# Complete archives
elseif($clean['show'] == "archives") {
if($total > 0) {
$theyear = int_filter($_GET['y']);
$themonth = $_GET['m'];
$thecategory = $_GET['c'];
$p = $clean['p'];
if($p == "main") {
echo adisplayall ($datadirectory, $total);
}
else {
if(isset($theyear) AND isset($themonth)) {
echo adisplaymonthandyear ($datadirectory, $total, $themonth, $theyear);
}
elseif(isset($thecategory)) {
echo adisplaycategory ($datadirectory, $total, $thecategory);
}
elseif(file_exists("$datadirectory/$p.php")) {
for($e=1; $e <= $total; $e++) {
if($p == $e) {
echo displayeach($datadirectory, $p);
}
}
}
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
}
}
else {
blogviewer("$lang[14]<br />\n\n", $blogtitle);
}
}
# Comment poster
elseif($clean['show'] == "postcomments") {
$date = date_and_time($timezone, "", "", "", "", "", "", "");
$name = string_filter($_POST['vname']);
$vemail = string_filter_email($_POST['vemail']);
$location = string_filter_url($_POST['vlocation']);
$comment = string_filter_comment($_POST['vcomment']);
$verify = string_filter_nospace($_POST['verify']);
$p = $clean['p'];
// (1) Block if there's no name, email and comment
if($name !== "" && $vemail !== "" && $comment !== "") {
// (2) Block if it doesn't have a valid email addie
if(ValidEmail($vemail)) {
$filecont = file_get_contents("comments/$p.php");
if($location == "") {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\tnone\t".$vemail."\t*/ ?>\n";
}
else {
if(substr($location, 0, 7)!=="http://") {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\thttp://".$location."\t".$vemail."\t*/ ?>\n";
}
else {
$all = "<?php /*\t".str_replace("\r\n", "<br />", $comment)."\t".$name."\t".$date."\t".$location."\t".$vemail."\t*/ ?>\n";
}
}
// (3) Block if the referrer is different from blog address in settings
if($_SERVER["HTTP_REFERER"]=="$blog/index.php?show=archives&p=$p") {
// (4) Verify session first before posting the comment.
if($verify!=="") {
session_start();
if($verify==$_SESSION['verify']) {
// (5) Block comment if it contains bad words
if(!strpos($comment, $badwords)) {
// (6) Do not post comment if the exact same comment and name already exists.
if(!preg_match("/\\t$comment\\t$name/", file_get_contents("comments/$p.php"))) {
$handle = fopen ("comments/$p.php", "a+");
fwrite ($handle, $all);
fclose ($handle);
// Email after comment has been posted. Negative (-) if not emailed.
if($emailcomments!=="yes") {
blogviewer($name.", $lang[15]<br />$lang[16]. -<br />\n\n", $blogtitle);
}
else {
$comment = str_replace("<br />", "\r\n", $comment);
if(mail($vemail, $lang[84], "$lang[85] $user,\r\n\r\n$name ($vemail) $lang[86] ($blogtitle). $lang[87]:\r\n\r\n------------\r\n\r\n$comment\r\n\r\n------------\r\n\r\n$lang[88]:\r\n$blog/admin.php?show=editdeletecomments\r\n\r\n$lang[89]\r\n\r\n$lang[90]", "From: $blogtitle <$email>")) {
blogviewer($name.", $lang[15]<br />$lang[16]. +<br />\n\n", $blogtitle);
}
else {
blogviewer($name.", $lang[15]<br />$lang[16]. -<br />\n\n", $blogtitle);
}
}
}
else {
blogviewer("$name, $lang[92]<br />$lang[21]<br />\n", $blogtitle);
}
}
else {
blogviewer("$name, $lang[93]<br />$lang[21]<br />\n", $blogtitle);
}
}
else {
blogviewer("$lang[17]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[18]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[19]<br />$lang[21]<br />\n", $blogtitle);
$session_degenerate_id;
}
}
else {
blogviewer("$lang[20]<br /><br />$lang[21]<br />\n", "$blogtitle");
$session_degenerate_id;
}
}
else {
blogviewer("$lang[22] <b>$lang[23]</b>, <b>$lang[24]</b>, $lang[25] <b>$lang[26]</b>.<br /> $lang[27]<br /><br />$lang[21]", "$blogtitle");
}
}
# Signed in
elseif($clean['show'] == "signinok") {
$mode = string_filter_nospace($_POST['mode']);
if($_POST['username'] !== '' AND $_POST['password'] !== '') {
# Administrator Mode
if($mode == "admin") {
$newsessionuser = md5($_POST['username'].mktime());
$newsessionpass = md5($_POST['password'].mktime());
if($newsessionuser == md5($user.mktime()) AND $newsessionpass == md5($pass.mktime())) {
session_destroy();
session_start();
$_SESSION['user'] = $user;
$_SESSION['mode'] = "admin";
adminpanel("$lang[28], <b>$auth</b>! <br /><br /> $lang[29]<br />$lang[30] $lang[31].<br />\n\n");
session_write_close();
}
else {
adminpanel ("$lang[32]<br />$lang[33] $lang[34].<br />\n\n");
$session_degenerate_id;
}
}
# User Mode
elseif($mode == "user") {
$usersdb = file_get_contents("usersdb.php");
$ida = explode($_POST['username']."\t", $usersdb);
$idb = str_replace("<?php /*\t", "", $ida[0]);
$idc = $idb - 1;
$passa = explode("\n", $usersdb);
$passb = explode("\t", $passa[$idc]);
$passc = $passb[4];
if(strpos($usersdb, $_POST['username']) !== FALSE AND $passc == md5($_POST['password'])) {
session_destroy();
session_start();
$_SESSION['user'] = $_POST['username'];
$_SESSION['mode'] = "user";
blogviewer("$lang[28], <b>".$_SESSION['user']."</b>! <br /><br /> $lang[29]<br /> $lang[30] $lang[35].<br />\n\n", "User's Panel");
session_write_close();
}
else {
blogviewer("$lang[32]<br />$lang[33] $lang[34].<br />\n\n", "User's Panel");
$session_degenerate_id;
}
}
# Anything else is invalid
else {
blogviewer("$lang[83] <br />\n\n", $lang[82]);
}
}
else {
blogviewer("$lang[36] <br />$lang[33] $lang[34].<br />\n\n", $lang[82]);
}
}
# Load 404 Page
else {
blogviewer("$lang[81]<br />\n\n", $lang[80]);
}
# Simple statistics
if(file_exists("counter.php")) {
$counterfile = file_get_contents("counter.php");
$counterdata = explode("|", $counterfile);
$countermagic = count($counterdata);
$h = fopen("counter.php", "a+");
fwrite($h, $_SERVER['REMOTE_ADDR']."|");
}
# Footer
$footer = implode(" ", file("themes/$oktheme/footer.php"));
$footer = str_replace("{blogtitle}", $blogtitle, $footer);
$header = str_replace("{subtitle}", subtitle($clean["show"], $clean["p"], $clean["f"]), $header);
$footer = str_replace("{metakeywords}", $metakeywords, $footer);
$footer = str_replace("{metadescription}", $metadescription, $footer);
$header = str_replace("{author}", $auth, $header);
$footer = str_replace("{header}", $blogheader, $footer);
$footer = str_replace("{mainlinks}", $mainlinks, $footer);
$footer = str_replace("{add-ons}", $addons, $footer);
$footer = str_replace("{search}", $search, $footer);
$footer = str_replace("{categories}", $categories, $footer);
$footer = str_replace("{archives}", $archives, $footer);
$footer = str_replace("{miscellaneous}", $miscellaneous, $footer);
$footer = str_replace("{adminmenu}", "", $footer);
$footer = str_replace("{usermenu}", "", $footer);
$footer = str_replace("{footer}", $blogfooter, $footer);
echo $footer;
# End flush for the session
ob_end_flush();
?>
All help appreciated.
Here's a fiddle with what I think is working.
Your problem was you had the div with a width of 950px, and inside that was a ol of 950px. When there's no room for a margin, auto will pick 0.
To fix this, remove the float from the outside div and set it to width:100%;. Then put all the background stuff in the ol. Finally put something at the end of the ol with clear: both;. A <br /> is the most common choice.
UPDATE:
Here's a full screen preview, in case the regular fiddle doesn't give you 950px.

Resources