Как се намества с PHP?

SuCcEsS

Registered
Някой може ли да ми каже как мога да намествам кое каде да бъде с PHP или става с HTML?
 
Целия изглед и подредба са с html. примерно

Код:
<?php 
$test = "има някактв текст или друго";
?>
<table>
<tr>
<td>текст ляв</td><td><?php echo "центриран"; ?></td><td><?php echo $test; ?></td></tr></table>
 
А за темата 2 в 1 която е след като моя код не е верен как е правилния? Понеже искам да смеся PHP с HTML код и да изисква регистрация как ще стане?
 
SuCcEsS каза:
А за темата 2 в 1 която е след като моя код не е верен как е правилния? Понеже искам да смеся PHP с HTML код и да изисква регистрация как ще стане?

Нещо не можах да те разбера.
 
Във темата 2 в 1 съм написал код с който да се смесва PHP и HTML но ми казаха че не било така питам как ще стане да се смеси дизайна (HTML) със PHP и да изисква регистрация.
 
Извинявам се обърках темата за тази говоря аз http://web-tourist.net/forum/viewtopic.php?t=9671
 
Код:
<html>
<head>
<title>test</title>
</head>
<img src="ligo.jpg">
<br>
<table> 
<tr> 
<td>ala bala</td>
<td><?php код за регистрация ?></td>
<td>ala bala</td>
</tr>
</table>

като в самия код за регистрация си имаш плета за попълване и там разните мъ работи.
 
Може ли да помоля някой да ми смеси една страничка HTML и една PHP, за да мога да разгледам кода и да го разуча и да мога сам да си го правя после?
 
file.php
Код:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page</title>
</head>

<body>
<?php echo"php chast";?>
html chast
</body>

</html>
 
ето ти една смесена:
резултата е тук
Код:
 <?php include ("config.php"); ?>



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $CHARSET ?>">
<title><?php echo $TITLE ?></title>
<LINK href="css/css.css" type=text/css rel=stylesheet>
</head>

<body>
<table width="900" border="0" cellspacing="3" cellpadding="0">
<tr>
<td><img src="img/logo.jpg" width="180" height="60"></td>
<td align="center"></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

<td class=text height="19" background="img/h_gr2.gif"> </td>
<td height="19" align="right" background="img/h_gr2.gif" class=text> </td>
</tr>
<tr>
<td align="right" colspan="2" class="nav" id="lineLRBs">
<table cellpadding="10" cellspacing="0" width="100%">
<tr>
<td width="55%"> </td>
<td align="right" width="45%">
<form method="GET" action="search.php">
<table cellpadding="0" cellspacing="0" width="300px" >
<tr>
<td align="right" width="200px"><input class=commentbox type="text" name="Search" size="30"></td>
<td align="right" width="100px"><input class=commentbox type="submit" value="<?php echo $SEARCH ?>" name="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15" colspan="2"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="199">

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

<td class=text height="19" background="img/h_gr2.gif"> <?php echo $MENU ?></td>
</tr>
<tr>
<td id="lineLRBs" class="nav"> <strong><a href="index.php"><?php echo $HOME ?></a></strong></td>
</tr>
<tr>
<td id="lineLRBs" class="nav"> <strong><a href="archive.php"><?php echo $ARCHIVE ?></a></strong></td>
</tr>
</table>
<br>

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

<td class=text height="19" background="img/h_gr2.gif"> <?php echo $CATEGORIES ?></td>
</tr>

<?php


mysql_connect($server, $dbusername, $dbpassword)or die("Сайтът не може да се свърже към базата данни");
@mysql_select_db($db_name) or die("Грешна база данни");
$query="SELECT * FROM cat ORDER BY cats ASC";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) {

$cats=mysql_result($result,$i,"cats");

echo "<tr><td id=lineLRBs class=nav> <strong><a href=catview.php?cats=$cats>$cats</a></strong></td></tr>";

$i++;
}

?>

</table>

<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>

<td class=text height="19" background="img/h_gr2.gif"> <?php echo $ANKETA ?></td>
</tr>
<tr>
<td id="lineLRBs" class="nav">
<?php
$ip= getenv("REMOTE_ADDR");
$sql="SELECT * FROM vaprosi ORDER BY v_id DESC LIMIT 0 , 1";
$rez=mysql_query($sql,$link);
$red=mysql_fetch_array($rez);
$vapros=$red['vapros'];
$v_id=$red['v_id'];

$sql1="SELECT * FROM ip WHERE `uip` LIKE '$ip' AND `v_id` LIKE '$v_id' ";
$rez1=mysql_query($sql1,$link);
$chekip=mysql_num_rows($rez1);

$sql1="SELECT * FROM ip WHERE `v_id` LIKE '$v_id'";
$rez1=mysql_query($sql1,$link);
$broiip=mysql_num_rows($rez1);

echo $vapros."<br /><br />";



if($chekip==0){


$sql="SELECT * FROM otgovori WHERE v_id LIKE '$v_id'";
$rez=mysql_query($sql,$link);


echo"<form action=\"sendvote.php\" method=\"POST\" >";


while($red=mysql_fetch_array($rez)){

echo "<input type=\"radio\" name=\"vote\" value=\"".$red['o_id']."\" />".$red['otgovor']."<br />";
}
echo"<center><br><input type=\"submit\" value=\"Гласувай\" /></center></form>";
}



else{

$sql="SELECT * FROM otgovori WHERE v_id LIKE '$v_id'";
$rez=mysql_query($sql,$link);


while($red=mysql_fetch_array($rez)){

echo "<table width=100%><tr>
<td width=130px>".$red['otgovor']."</td>
<td width=30px>".$red['rezultat']."</td>
</tr>
</table>";



}

}

mysql_close($link);
?>
</td>
</tr>
</table>
</td>
<td valign="top" width="692">

<?php


mysql_connect($server, $dbusername, $dbpassword)or die("Сайтът не може да се свърже към базата данни");
@mysql_select_db($db_name) or die("Грешна база данни");
$jor="SELECT * FROM news ORDER BY id_news DESC LIMIT 0,10";
$roj=mysql_query($jor);

$num=mysql_numrows($roj);

mysql_close();

$i=0;
while ($i < $num) {

$id_news=mysql_result($roj,$i,"id_news");
$title=mysql_result($roj,$i,"title");
$chas=mysql_result($roj,$i,"chas");
$minuti=mysql_result($roj,$i,"minuti");
$den=mysql_result($roj,$i,"den");
$mesec=mysql_result($roj,$i,"mesec");
$godina=mysql_result($roj,$i,"godina");
$cats=mysql_result($roj,$i,"cats");
$newstext=mysql_result($roj,$i,"newstext");

$start=strlen($str);
$text=substr($newstext,$start ,$broinews);

echo "<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>

<td class=text height=19 background=img/h_gr2.gif> <strong><a href=fullnews.php?id_news=$id_news>$title</a></strong></td>
</tr>

<tr>
<td>
<table id=lineLRBs class=nav border=0 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td height=25px id=lineBottom width=33%> Категория: <strong><a href=catview.php?cats=$cats>$cats</a></strong></td>
<td height=25px id=lineBottom width=33%> </td>
<td height=25px id=lineBottom width=34%> <strong>$chas:$minuti - $den/$mesec/$godina</strong></td>
</tr>
<tr>
<td id=lineBottom width=100% colspan=3><div><table cellpadding=5 width=100%>
<tr>
<td width=100%><p align=justify>$text...</p></td>
</tr>
</table></div></td>
</tr>
<tr>
<td height=25px width=33%> <strong><a href=addcomment.php?id_news=$id_news>Коментари</a></strong></td>
<td height=25px width=33%> </td>
<td height=25px width=34%> <a href=fullnews.php?id_news=$id_news><strong>Прочети цялата новина</strong></a></td>
</tr>
</table>";
echo "<br>";
$i++;
}

?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</body>
</html>
 
Добре както и да е искам само да попитам можеш ли да направиш този скрипт при определен брой качени линкове да прави нова страница :) и да е с черен background :)

Код:
<?php

include "config.php";

//Set the page size

$StartRow = 0;

//Set the page no
if(empty($_GET['PageNo'])){
    if($StartRow == 0){
        $PageNo = $StartRow + 1;
    }
}else{
    $PageNo = $_GET['PageNo'];
    $StartRow = ($PageNo - 1) * $PageSize;
}

//Set the counter start
if($PageNo % $PageSize == 0){
    $CounterStart = $PageNo - ($PageSize - 1);
}else{
    $CounterStart = $PageNo - ($PageNo % $PageSize) + 1;
}

//Counter End
$CounterEnd = $CounterStart + ($PageSize - 1);
?>

<html>
<head>
<title>BGinfo</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">

BODY {
	FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
H3 {
	COLOR: #526ba5
}
H4 {
	COLOR: #526ba5
}
.Issue {
	BACKGROUND-COLOR: #11111
}
.NormalField {
	FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Verdana;BACKGROUND-COLOR: #ffffff
}
.NormalFieldTwo {
	FONT-SIZE: 7pt;

	FONT-FAMILY: Verdana;
	background : #E4E4E4;
	font-weight : bold
}
.NormalFieldThree {
	FONT-SIZE: 10pt;
	COLOR: Yellow;
	FONT-FAMILY: Verdana;
	background : #0C79B4;
	font-weight : bold;
	text-align : center;
}

.NormalFieldFour {
	FONT-SIZE: 10pt;
	COLOR: Yellow;
	FONT-FAMILY: Verdana;
	background : Black;
	font-weight : bold;
	text-align : center;
}
.NormalFieldFive {
	FONT-WEIGHT: bold;
	FONT-SIZE: 10pt;
	COLOR: Navy;
	FONT-FAMILY: Verdana;
	BACKGROUND-COLOR: #ffffff
}
.NormalFieldSix {
		FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}

.TableText {
	FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Arial
}
.TableBorder{
	border-color : #00000;
}
.NormalTable {
	BACKGROUND-COLOR: #ffffff
}
.NormalTableTwo {
	BACKGROUND-COLOR: #eeeeee
}
.UsePageBG {
	BACKGROUND-COLOR: #cccccc
}
.UseTableBG {
	BACKGROUND-COLOR: #526ba5
}
.UseDialogBG {
	BACKGROUND-IMAGE: url(../Graphics/Images/DialogBackGround.gif)
}
.ReadOnlyField {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526000; FONT-FAMILY: Arial
}
.InternalHeader {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Arial; BACKGROUND-COLOR: #526ba5;
}
.AttachedFiles {
	BACKGROUND-COLOR: #00000;
	color : #00000
}
.SpecialAnchor {
	FONT-FAMILY: Arial; TEXT-DECORATION: none
}
UNKNOWN {
	FONT-WEIGHT: lighter; FONT-SIZE: 8pt; TEXT-TRANSFORM: capitalize; COLOR: navy; FONT-STYLE: normal; FONT-FAMILY: 'Arial', Times New Roman, Verdana; FONT-VARIANT: normal; TEXT-DECORATION: underline
}
.SearchResults {
	FONT-WEIGHT: normal; FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.MandatoryFields {
	FONT-WEIGHT: normal; FONT-SIZE: 10pt; COLOR: #ff0000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.tab-above-heading {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.textareaLabel {
	FONT-WEIGHT: bolder; FONT-SIZE: 10pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
.linkStyle {
	TEXT-DECORATION: none
}
.PageTitle {
	FONT-WEIGHT: bold; FONT-SIZE: 16pt; COLOR: #526ba5; FONT-FAMILY: Tahoma
}
.smallfont {
	FONT-SIZE: 7.5pt; COLOR: #000000; FONT-FAMILY: Arial
}
A {
	COLOR: Red;
	TEXT-DECORATION: none
}

 #nav {
background-color: #D5D5D5;
border: 1px solid #B8B8B8;
padding-top: 8px;
height: 21px;
padding-left: 3px;
}
#nav a {
border: 1px solid #B7B7B7;
padding: 4px;
background-color: #F3F3F3;
color: #0077B4;
font-weight: bold;
text-decoration: none;
font-family: Verdana, Sans-Serif;
font-size: 12px;
}
#nav a:hover {
color: #00A8FF;
background-color: #00000;
border: 1px solid #727272;
border-bottom: 1px solid #ffffff;
}
</style>
</head>
<body class="UsePageBg">
<form method="GET" action="">
<table cellpadding="0" cellspacing="0" width="300px" align="center" cellpadding="0" >
<input type="text" name="q" size="25">
<tr>
  <td align="right" width="200px"> </td>
  <td align="right" width="100px"><input type="submit" value="Търсене"></td>
</tr>
</table>
</form>
<?php
$tarsene = $_GET['q'];

if($_GET['q'])
{
$trimmed = trim($tarsene); 
$var = explode(" ",$trimmed); 
$count = count($var); 


for($i = $count-1;$i < sizeof($var); $i++) {

$abc = $var[$i]; 

 mysql_connect($server, $dbusername, $dbpassword)or die("Сайтът не може да се свърже към базата данни");
 @mysql_select_db($db_name) or die("Грешна база данни");
 $TRecord = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%'");
 $result = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%' ORDER BY `id` DESC LIMIT $StartRow,$PageSize");

 //Total of record
 $RecordCount = mysql_num_rows($TRecord);

 //Set Maximum Page
 $MaxPage = $RecordCount % $PageSize;
 if($RecordCount % $PageSize == 0){
    $MaxPage = $RecordCount / $PageSize;
 }else{
    $MaxPage = ceil($RecordCount / $PageSize);
 }
?>

<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td width="24%"></td>
    <td width="76%">
      <div align="right"> 
        <?php print "$RecordCount запис(а) намерен(и) - Вие сте на страница $PageNo от $MaxPage" ?></div>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="0" class="NormalTableTwo">
  <tr> 
    <td class="InternalHeader" width="5%">Номер</td>
    <td class="InternalHeader" width="60%">Име</td>
	<td class="InternalHeader" width="20%">Тип</td>
    <td class="InternalHeader" width="15%">Добавен</td>
  </tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
$id=$row[id]; 
$data=$row[data]; 
$fulllinks=$row[fulllinks]; 
$files=$row[files];
$tipfail=$row[tipfail];

 
    $bil = $i + ($PageNo-1)*$PageSize;
	
?>

  <tr> 
    <td class="NormalFieldTwo" width="5%"><?php echo $bil ?></td>
    <td class="NormalFieldTwo" width="60%"><a href="s.php?id=<?php echo $id; ?>" target="_new"><?php echo $files ?></a></td>
	<td class="NormalFieldTwo" width="20%"><?php echo $tipfail ?></td>
	<td class="NormalFieldTwo" width="15%"><?php echo $data ?></td>
 </tr>
<?php
  $i++;
}?>
</table><br>
<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td>

      <div align="center">
      <?php
        //Print First & Previous Link is necessary
        if($CounterStart != 1){
            $PrevStart = $CounterStart - 1;
            print "<a href=?q=$tarsene&PageNo=1>Първи </a>: ";
            print "<a href=?q=$tarsene&PageNo=$PrevStart>Предишни $PageSize </a>";
        }
        print " [ ";
        $c = 0;

        //Print Page No
        for($c=$CounterStart;$c<=$CounterEnd;$c++){
            if($c < $MaxPage){
                if($c == $PageNo){
                    if($c % $PageSize == 0){
                        print "$c ";
                    }else{
                        print "$c ,";
                    }
                }elseif($c % $PageSize == 0){
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                }else{
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ,";
                }//END IF
            }else{
                if($PageNo == $MaxPage){
                    print "$c ";
                    break;
                }else{
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                    break;
                }//END IF
            }//END IF
       }//NEXT

      echo "] ";

      if($CounterEnd < $MaxPage){
          $NextPage = $CounterEnd + 1;
          echo "<a href=?q=$tarsene&PageNo=$NextPage>Следващи $PageSize</a>";
      }
      
      //Print Last link if necessary
      if($CounterEnd < $MaxPage){
       $LastRec = $RecordCount % $PageSize;
        if($LastRec == 0){
            $LastStartRecord = $RecordCount - $PageSize;
        }
        else{
            $LastStartRecord = $RecordCount - $LastRec;
        }

        print " : ";
        echo "<a href=?q=$tarsene&PageNo=$MaxPage>Последни</a>";
        }
      ?>
      </div>
    </td>
  </tr>
</table>
<?php
    mysql_free_result($result);

    mysql_free_result($TRecord);
	}}

?>

</body>
</html>
 
аз мога, защото е от моя система, той дори и това прави, просто си изпуснал че в конфиг файла има
Код:
$PageSize = 25; //po kolko reda na stranica da pokazva.

което определя по колко да показва. може да го добавиш или в конфига или веднага след
Код:
<?php

include "config.php";

//Set the page size

$StartRow = 0;
за бекграунда замени
Код:
BODY {
   FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
с това
Код:
BODY {
   FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
   BACKGROUND-COLOR: #000000
}
 
А неможах да разбера кода има ли си линкове към links.php и останалите файлове ?
 

Back
Горе