Home Links
Home Page
How to us to correct the person who has entered
Yandex - like search by the hands
Stemmer.
Creation of sites - model of qualitative imposition
Entrance parameter of function is the file from six elements
Promotion of a site in Rambler
The good design should make a profit
Validnost` HTML
Perenapravlenie mistakes in a browser - 100 % as in PHP
Terrible animal the traffic
Cajt with help HTML:: Mason
Choice of the module
Bases of
Creation of a site
Adjustment of a site
TT - the counter of the traffic
GetCurrBytes
OnOverflow
Small improvements of our counter
 

Creation of sites - model of qualitative imposition

Let's start with that the essence of my clause{article} first of all consists in creation of convenient model of imposition of our projects. Sometimes walking on a network, I shall come across on very well made a web - sites but when, I start to examine internal structure of a site am terrified. The matter is that at creation of sites of different complexity and structure, I have turned out considerable experience and I can say confidently to you, that in some days when the customer asks to change the color circuit in any section, fonts or still that or. It is not so easy to make it and if still this imposition other person did{made} that it it is problematic. But if initially to design model it is possible very{very much} even to edit a site easily. And so our problem{task} will be to create model of qualitative imposition in which with ease other editors would be guided.


You, probably, ask, that it for model of qualitative imposition. First, it initially competently designed structure of all files. Second, it is beforehand logically broken tables of styles (CSS) and born in separate files. Well and, certainly, validnyj HTML. The model of qualitative imposition as means it, that after she is ready, with ease others can edit her{it} verstal`hhiki.


And so we shall assume at us there is a certain site, he will consist of 4 pages, and at each page the color circuit, but pattern HTML at all pages identical.


On these to 2 pictures I have approximately described the given problem{task}. Now having seen it is necessary for us to divide{share} all into it that, we have at least on 2 parts, those which meet on all pages and those which concern only to one page. I offer the following structure of our project, all files henceforth we shall name the names for other editors for they too should be guided here with ease.



..

/store/

/store/css/

/store/css/common.css - the basic table of styles

/store/css/main.css - the table of styles for a page "main"

/store/css/news.css - the table of styles for a page "news"

/store/css/shop.css - the table of styles for a page "shop"

/store/css/mail.css - the table of styles for a page "e-Mail"

/store/i/-here there will be we of a picture

/main.html - a page "main"

/news.html - a page "news"

/shop.html - a page "shop"

/mail.html - a page "e-Mail"


For us it is for the beginning necessary HTML a pattern for all pages. I offer one of the most actual for today of styles of imposition Div/XHTML strict (<em> I shall once again be repeated what to explain itself HTML not the primary goal of my clause{article} so, I I hope that all is understandable that is written below </em>):



<! 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 = "en-US" lang = "en-US">

<head>

<meta http-equiv = "Content-Type" content = " text/html; charset=utf-8 "/>

<meta name = "keywords" content = " project keywords "/>

<meta name = "description" content = " project description "/>

<title> Project title </title>

<link rel = "stylesheet" type = "text/css" href = "store/css/main.css"/>

</head>

<body>

<div class = "container">

<div class = "header"> <img src = "store/i/logo.gif" alt = “ Project slogan “/> </div>

<ul class = "top-menu">

<li class = "main"> <a href = "main.html"> main </a> </li>

<li class = "news"> <a href = "news.html"> news </a> </li>

<li class = "shop"> <a href = "shop.html"> shop </a> </li>

<li class = "mail"> <a href = "mail.html"> e-mail </a> </li>

</ul>

<div class = "clear-all"> *nbsp; </div>

<div class = "content">

<h1> Header text </h1>

<p> Loren ipsum dolor sit amet. </p>

<p> Loren ipsum dolor sit amet. </p>

<h1> Header text </h1>

<p> Loren ipsum dolor sit amet. </p>

<p> Loren ipsum dolor sit amet. </p>

</div>

</div>

</body>

</html>


And so we have a decent pattern of pages and internal structure of a site, now it is high time to engage in creation of tables of style for them. We shall start with the basic table of style, in her there should be all general{common} styles of elements of our site which meet on all page. But that in this case our site has not one color circuit, there is a sense to separate color circuits in separate files, from the basic table of styles, for convenience of their editing.


File common.css - in him we describe the basic styles for our pages, such as width, height, the sizes of fonts, spaces, etc.:



body {

height:100 %;

font: 100 % Arial, Arial Narrow; - do not deprive with the user of an opportunity to change the size of the text

padding:0;

margin:0;

background: *FFF;

overflow:auto; - does not display skrol when the page approaches under the sizes of a window of a browser

}

h1, h2, h3, h4, h5, h6, p {

margin: 0;

padding: 0;

border: 0;

text-align: left;

}

ul, li {

padding: 0;

margin: 0;

list-style: none;

}

img {

border: 0;

}

a {

font-size: 0.8em;

ext-decoration: underline;

}

.clear-all {

line-height: 0;

height: 0;

clear: both;

font-size: 0;

margin: 0;

padding: 0;

position: static;

float: none;

display: block;

}

/* Get used to the structured tables of style, facilitates an opportunity of editing */

div.container {

width: 750px;

margin: 10px auto;

}

div.container div.header {

height: 150px;

background: red;

}

div.container div.header img {

position: relative;

top: 20px;

left: 20px;

}

div.container ul.top-menu li {

display: block;

padding:3px;

float: left;

}

div.container ul.top-menu li a {

display: block;

font-size: 1em;

height:20px;

text-align: center;

padding:3px 10px;

}

div.container div.content {

padding:0 20px 20px 20px;

}

div.container div.content h1 {

font-size: 1.2em;

padding-bottom:5px;

padding-top:20px;

}

div.container div.content p {

font-size: 0.8em;

padding:5px 0;

}


File main.css - in him we describe everything, that there is only in this page, in this case it only the color circuit, but anybody to us does not forbid to add here still, that - or concerning this page:



/* And so first this association of objects, in one group */


import ('common.css'); - it is connected the main table of styles


div.container div.header,

div.container div.content {

background-color: red;

}

div.container div.content h1 {

color: *57001f;

}

div.container div.content p {

color: *FFF;

}


… further there can be any additional styles to this page


File news.css:


/* And so first this association of objects, in one group */


import ('common.css'); - it is connected the main table of styles


div.container div.header,

div.container div.content {

background-color: *88007d;

}

div.container div.content h1 {

color: red;

}

div.container div.content p {

color: *FFF;

}


… further there can be any additional styles to this page


Well, in general - that and everything, now we is simple to each page we connect the necessary table of styles and we have: qualitatively and validno made out HTML (pure{clean}), intuitively understandable to other editors internal structure of a site and tables of styles ready to any experiments (that not so often meets in a network). Try to think over own model, in fact she can turn out where better offered{suggested} by me, experiment, and all at you will turn out.


Functions of a paginal conclusion in PHP

Hello dear readers, today it would be desirable will discuss a problem of a paginal conclusion in PHP and to result possible{probable} ways of the decision. In this clause{article} I shall result rather unique function from the point of view of its{her} opportunities.


Often at creation of dynamic sites (there are no pages as such) on a database or on files there is a question on a paginal conclusion of the information be - that clauses{articles}, archive of news or that nibud` another containing dovl`no a plenty of pages.

Therefore we begin (if we shall not think or somebody will not help) to ransack on the Internet in searches of the necessary code, but a decent paginal conclusion to find hardly. So we shall try to make today that nibud` good, and the main thing working.


Below the code of the elementary function of a paginal conclusion will be resulted, this function can be used on small sites. All comments will be resulted in the function, I think you will understand.


/*Prostejshaja Function of a paginal conclusion, nazavjom her{it} it is simple PagePrint*/

function PagePrint ($start, $count) {

$HrefPage = "; //----we Create a variable which will contain a paginal conclusion

$number=10; //----Quantity{Amount} of recordings on page

/*Podschityvaem Quantity{Amount} of pages, where $count - total of recordings, $number - quantity{amount} of recordings on stranice*/

$CountPage = (int) (($count + $ number-1) / $number);

/*Perebiraem In a cycle all stranicy*/

for ($link=1; $link <= $CountPage; $link ++):

$PageStart = ($ link - 1) * $number; //----we Consider a point of sample of a database

$HrefPage = $ HrefPage. " <a href = ".getenv ('PHP_SELF'). "? start = ". $ PageStart. " target = _ parent> ". $link. " </a> "; // - we Form links

endfor;

return $HrefPage;

}


You see, that function has two entrance parameters $start - a point of sample of a database and $count - quantity{amount} of the data, in a file or in a database. This function the most simple so on it{her} there is not enough hope at use on large sites where a lot of information.


Let's consider more complex{difficult} function, but having there is more than functionality.



function PagePrint ($variable) {

global $beginPage, $endPage; //------It is declared the global variables responsible for the link to first and last page

$href = "; //-----Peremmennaja containing in itself a paginal conclusion

$separator = ''; //-----the Variable specifying a separator between links, by default a blank

$style ='style = "text-decoration:none" style = "color:orange" style = "font-weight:bold" '; //-------Sets style of the current page

$stylePage ='style = "text-decoration:none" style = "color:blue" style = "font-weight:bold" '; //------Sets style of the link to first and last page

if (is_array ($variable)): //------we Check type array

*?????????? the file also is appropriated{given} $number - quantity{amount} of recordings, $start - a point of extraction, $pageCount - quantity{amount} of recordings, $andere - other properties of the link, $class - style for links, $showLink - quantity{amount} of links on page

list ($number, $start, $pageCount, $andere, $class, $showLink) = $variable;

*??????????? $start

if (empty ($start) **! is_int ($start) **! is_numeric ($start)) $start=0;

else $start = $ start;

*???????????? $number

if (empty ($number) **! is_int ($number) **! is_numeric ($number)) $number=10;

else $number = $ number;



$page = (($start/10) +1); //-------Rasschityvavem number{room} of page

$count=ceil ($pageCount / $ number); //------Quantity{Amount} of pages


*???«? sslyki on first and last pages

if ($count! == 1):

$beginPage = " <a href = "".getenv ('PHP_SELF'). "? start=0 ". $andere. "" ". $stylePage. "> perv </a> "; //--------the First page

$endPage = " <a href = "".getenv ('PHP_SELF'). "? start = ". (($count-1) *10). $andere. "" ". $stylePage. "> posl </a> "; //-----Last page

else: FALSE;

endif;


if ($pageCount == 10): return False;

else:

*?«?????????® a conclusion

$begin = $ page - intval ($showLink/2); //------Defines{Determines} number{room} of page with which to deduce{remove}

for ($j=0; $j <= $showLink; $j ++):

$i = $ begin + $ j; //------Number{Room} of page

*???????? the script if $ <0, will increase until then while $showPage=1

if ($i <1):

$showLink ++;

continue;

endif;

*?«?????????® a conclusion

if ($i> $count) break; //-----Protection if quantity{amount} $i> possible{probable} recordings

if ($i == $page) $href = $ href. " <a ". $style. ">". $i. " </a> "; //------the Conclusion of the current page

else $href = $ href. " <a href = "".getenv ('PHP_SELF'). "? start = ". (($i - 1) *10). $andere. "" ". $class. ">". $ i. " </a> "; //------the Conclusion of the following pages

endfor;

return $href;

endif;

endif;

}