i am trying to filter data using preg_match it seems to be correct and matching on view source code but when i run the code it gives no match found
here is my pattern
/\<p\>(.*)\<center\>/
string is
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<small>Photo courtesy of hortongrou </small>
</div>
<p>I have developed theasional thriller.<br />
<code> </code><br />
<li><strong>Beginning Ubuntu Linux<img style="border:none !important; margin:0px !important;" src="" border="0" alt="" width="1" height="1" />, by Keir Thomas and Jaime Sicam.</strong> For those who like to transition from Windows to Linux, install Ubuntu Linux on one of yoto you.</li>
</ol>
<p class="alert">For more Linux books that I recommend, browse <a rel="nofollow" href="http://astore.amazon.com/thgest-20">The Geek Stuff bookstore at Amazon.</a></p>
<p>There are several hundreds of books on Linux. <strong>What is your favorite Linux book that is not on this list?</strong><br />
<code> </code><br />
<em>If you like this article, please bookmark it on <strong>delicious and Stumble it</strong>.</em></p>
<center>
<div style="margin-left:2px; margin-top:10px; margin-bottom:10px; ">
<!-- AD BLOCK -->
</body>
By default . doesn’t match new lines. Try adding DOTALL (s) modifier like this /<p>(.*)<center>/s.
Related
This output run fine in HTML / PHP:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<title>(PAbi)</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<link rel="icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" />
<style type="text/css">html,body{margin:0;padding:0;background:#000;color:#fff;font-family:helvetica;}
.pie{position:fixed;width:100%;bottom:0;color:#000;background:#fff9f2;font-size:6.5pt;text-align:center;border-top:1px dashed #aa0000;}
#indice{width:430px;margin:auto;}
#indice dt{float:left;width:300px;overflow:hidden;white-space:nowrap;}
#indice dd{margin:0;float:left;width:100px;overflow:hidden;}
#indice dt span:after{content:".....................................................";}
</style></head>
<body><div id="cosmos"><br />
<h1 class="marin">index</h1>
<ul id="indice">
<dt><span>Índice</span></dt><dd>2</dd>
<dt><span>intro</span></dt><dd>3</dd>
<dt><span>functions</span></dt><dd>4</dd>
</ul></div>
<div class="pie">Aliens is here</div>
</body></html>
just as you can see, I need create the index page, then I need this "doits", I get this code from:
CSS Justify text, fill space with dots
But when I export to PDF with DOMPDF, the display go bad...
Thanks by any help to I can create the page "index" using doits to numbers of pages?, thanks!
Regards friends.
Using this code I can "create" my "page index" using:
XHTML
DOMPDF
index info with "doits" to show page number
Problem is when you used from css [TAG:after{content:"...your string here...";}]
DOMPDF forever put a newline and then display of "page index" is wrong in the document PDF.
maybe any person want used this option...
<?php
// I put excesive doits only by do test xD
$puntos = str_repeat('.', 999);
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head><title>(PAbi)</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<link rel="icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico" type="image/x-icon" />
<style type="text/css">
table{width:650px;border-spacing:0.5em;}
#indice1 td{overflow:hidden;max-width:400px;border-radius:2em;padding:0.3em;}
#indice1 span:after{content:"'.$puntos.'";}
.numpa{text-align:center;width:20px;background:#d3dbfa;border:1px solid #000;}
.info{width:205px;background:#d1f6a5;border:1px solid #000;}
</style></head><body>
<table id="indice1"><tr>
<td class="info">ÍNDICE</td>
<td class="puntos"><span></span></td>
<td class="numpa">2</td></tr><tr>
<td class="info">Introducción</td>
<td class="puntos"><span></span></td>
<td class="numpa">3</td></tr><tr>
<td class="info">Características del servicio</td>
<td class="puntos"><span></span></td>
<td class="numpa">4</td>
</tr></table></body></html>';
?>
Unfortunately Dompdf (current release being v0.8.0) is unable to handle that particular styling. The main issue is that Dompdf does not correctly reflow floats at the end of the line. But even if you force it using something like #indice dd + dt { clear: both; } Dompdf does not appropriately clear the float and continues writing floats the additional floats to the same line.
I've gone through the archives and read a bunch of questions relating to why PHP include won't work. I've tried to fix my problem using answers to the other questions, but am still having issues.
This is my code:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fuel Status Map</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="map">
<?
require 'MapLink.php';
?></div>
<div id="title"><img src="title.png" width="400" height="200" />
</div>
<div id="links">
<img src="FuelStatusLink.png" width="400" />
<br />
<img src="NWSofficeLink.png" width="400" />
<br />
<img src="FuelSpecialistLink.png" width="400" />
<br />
<img src="AdminLink.png" width="400" />
<br />
</div>
<div id="legend"><img src="Legend1.png" width="400">
</div>
<div id="logos">
<img src="PSlogo.png" width="140" height="150" />
<img src="GBlogo.png" width="250" height="150"/>
</div>
</div>
</body>
</html>
The page is supposed to look like this: http://www.directdocuments.com/GACC/GBSite/predictive/FuelStatus/FuelStatusMap.php
but looks like this: http://gacc.nifc.gov/gbcc/predictive/FuelStatus/FuelStatusMap.php
The MapLink.php is in the same directory, and works correctly. I'd post the link to that as well, but I can't post any more links.
It looks like you don't have short open tags enabled in your PHP configuration, so the require line is being output literally (use View Source to see this). Use the full tag.
<?php
require 'MapLink.php';
?>
From the documentation:
PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).
See also Are PHP short tags acceptable to use?
i have a maintenance page 503.php. I tried to get the images to be displayed but it did not show. I tried path and html img way, but it did not work. Below are the codes and also anyone helps me explain how to included images in php file?
My website images directory is like this:
on server: pulic_html/website/images
on local: website/images
php file dir: website/503.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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
<?php
header("HTTP/1.1 503 Service Temporarily Unavailable");
header("Status: 503 Service Temporarily Unavailable");
header("Retry-After: 3600");
?>
</title>
<style type="text/css">
body {
background-image: url("../images/black-brick-wall-texture.jpg");
}
</style>
</head>
<body>
<div>
<div>
<p style="text-alignment: middle"><img src="../images/still-under-construction.gif" width="306" height="350" alt="dang duoc bao tri" />" </p>
</div>
<div style="text-align: center; font-size: 24px; color: #FFF;">
<p>BSeveryday.vn hiện <span style="color: #F00">under maintenance</span>, please come back later <span style="color: #F00">30p - 2 giở</span>.</p>
<p>if you have any problem, please send me a message at: <span style="color: #00F">vandekhac#bseveryday.vn</span></p>
</div>
</div>
<p><img src="../images/under_construction.gif" alt="under maintenance" width="350" height="299" align="right" />" </p>
</body>
</html>
In the .htaccess file in the website's root directory insert the following line before your RewriteRule line::
RewriteCond %{REQUEST_FILENAME} !.(gif|jpe?g|png)$
You may need to add css or js to that list of filetypes, depending on your holding page’s needs.
It may solve your problem.
I had a problem that I was struggling with a couple days ago, and the problem lies in my session id handling while using localhost (xampp local server).
What I now tried to do, is to create two separate pages, the first one randomizes a session id in such a way:
<?php
session_start();
$random_number = rand();
$_SESSION['random_number'] = $random_number;
?>
<!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="en"
lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<link rel="stylesheet" href="style.css" />
<title>Understanding PHP sessions...Page 1</title>
</head>
<body>
<div id="contentarea">
<div id="innercontentarea">
<h2>Understanding PHP sessions...Page 1</h2>
<p>Random number generated
<span style="font-weight:bold;">
<?php echo $_SESSION['random_number']; ?>
</span>
</p>
<p>PHP session id
<span style="text-decoration:underline;">
<?php echo session_id(); ?>
</span>
</p>
Go to next page
</div>
</div>
</body>
</html>
So, this creates a random session number here, and should output the same number on the second page basic_session2, which basically the same, but the difference is in session initialization, which is only:
<?php
session_start();
?>
<!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="en"
lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<link rel="stylesheet" href="style.css" />
<title>Understanding PHP sessions...Page 2</title>
</head>
<body>
<div id="contentarea">
<div id="innercontentarea">
<h2>Understanding PHP sessions...Page 2</h2>
<p>My Favorite movie is
<span style="font-weight:bold;">
<?php echo $_SESSION['random_number']; ?>
</span>
</p>
<p>PHP session id
<span style="text-decoration:underline;">
<?php echo session_id(); ?>
</span>
</p>
</div>
</div>
</body>
</html>
But it echoes out a different random number! So, now, I am guessing there is a problem with my session cookie path, as this session number is not holding up.
The system I use is Ubuntu, and the localhost directory for xampp is a standard one. Do you know how to solve that issue, or maybe encountered such a problem?
So Lately i was working on a website on LocalHost Using XAMPP Application.
So i created header.php with the code
<!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" xml:lang="nl" lang="nl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="A short description." />
<meta name="keywords" content="put, keywords, here" />
<title>Website Name</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="menu">
<a class="item" href="index.php">Home</a>
<a class="item" href="../forum/">Forums</a>
<a class="item" href="live-chat.php">Live Chat</a>
<a class="item" href="Login.php">Log In</a>
<a class="item" href="Register.php">Register Now!</a>
<div id="userbar">
<?php
error_reporting(E_ALL & ~E_NOTICE);
include 'search.php';
if($_SESSION['signed_in'])
{
echo 'Welcome <b>' . htmlentities($_SESSION['user_name']) . '</b>. Not you? <a class="item" href="logout.php">Log out</a>';
}
?>
</div>
</div>
<div id="content">
And a Login.php with this code ( Here is the 4 lines of it ) :
<?php
include 'connect.php';
include 'header.php';
etc..... php code....
Ok so the problem is When i try to open the login.php in web browser i got the code in header.php duplication many many times like it don't end duplicating it self and if i open the source code of login.php i will got unlimited number of the code used in header.php like all the source code is header.php repeatedly.
So I'am asking you guys for help on how to fix this and what is the error ??
NOTE: Sorry if their was a thread duplication but i didn't know on what to search exactly.
If you want anymore information I'am ready.
Thanks all much appreciated
Use
include_once('header.php');
everywhere instead. It will check to see if the file has already been included.
use require_once instead, it will load the file just once, and only if needed.
You have more info here