Jump to content
php.lv forumi

php include rada baltu liiniju un <head> radas tuksh


Recommended Posts

Vai kaads var paliidzeet ar include, require_once ?

index failaa iekljaavu <?php include("includes/header.php"); ?>, header.php saakums izskataas shaadi:

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Liidziigs gljuks bija kad meigjinaaju define constants iekljaut connection.php failaa..

Probleema - <head> radas tuksh un head info iet iekshaa <body> un pirmaa liinija radas balta body tagaa.

 

(pirmais include)

Link to post
Share on other sites

es peļauju, ka tev ir nepareiza html struktūra un gudrais pārlūks visu uzdara kā nākas, varbūt iepostē ko tad īsti tev atgriež tas pārlūks kad palaid skriptu :)

Link to post
Share on other sites

no firebug:

html xmlns="http://www.w3.org/1999/xhtml">


<head></head>

<body>


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

<title>titles</title>

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

<link type="image/x-icon" href="favicon.ico" rel="icon">

<link type="image/x-icon" href="favicon.ico" rel="shortcut">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript">

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" type="text/javascript">

<script src="js/jquery.droppy.js" type="text/javascript">

<div id="navDiv">

<div id="wrapper"><---------------------- visi html tagi iekljauti te -------------->

<script type="text/javascript">

<script type="text/javascript">

<script type="text/javascript">

<div id="ui-datepicker-div" style="display: none;"></div>
</body>
</html>

 

kaa iznjemu <?php require_once("includes/functions.php"); ?> rindinju taa viss html pareizi raadas.

Edited by nepateemu
Link to post
Share on other sites

pamēģini to <?php require_once("includes/functions.php"); ?> ielikt kaut kur starp body tagiem un paskaties kas notiek. Izskatās, ka sintakse ir pareiza functions.php saturam, bet varbūt izlec kāds cits paziņojums :)

Link to post
Share on other sites

Jau meigjinaaju ielikt citur starp tagiem / apvienot vienaa require_one | include / komentaaru ielikt pirms funkcijas php tagaa. Ja uztaisu kljuudu, tad baltaas rindinjas vietaa raadas errora teksts un pareejais viss ielaadeejas (liekot iekshaa visu body tagaa)

Edited by nepateemu
Link to post
Share on other sites

Firebugā tu jau redzi html kā to pārveidojis firefox, skaties iekš View Page Source(ctrl + u). Ja tur viss ir pareizā secībā, tad pieļauju, ka functions.php veic kaut kādu izvadi (tukšas rindas, space, BOM), kā dēļ lapa tiek attiecīgi pārveidota.

Link to post
Share on other sites

Novacot iekļautajos failos ?> nedeva rezultātu. Ja nonjemu beigu ?> tad velarvien lapa ielaadeejas nepareizi, ja php failos iznjemu php saturu un atstaaju tikai html tad viss ielaadeejas pareizi, tachu php arii nodereetu...

Connection.php saturs:

<?php
require("constants.php");
  	 $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
  	 if(!$connection) {
  		 die("Database connection failed: " . mysql_error());
  	 }
  	 $db_select = mysql_select_db(DB_NAME,$connection );
  		 if(!$db_select){
  			 die("Database selection failed: " .  mysql_error());
  		 }
?>

Edited by nepateemu
Link to post
Share on other sites

Ja failā ir tikai PHP (lasi: nav HTML), tad aizverošo (?>) PHP tagu atstāšana tur ir slikta prakse, jā. Tā bija rakstīts PHP manuālī! :)

Link to post
Share on other sites

peec traumas ar lv garumziimem visur liku utf-8, nezinaaju ka tas php gadiijumaa vareeja radiit shaadas probleemas.. index failam atstaaju utf-8, bet visiem include failiem uzliku ANSI kodeejumu un tagad gan head, gan viss pārējais rādās pareizi..

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...