Jump to content
php.lv forumi

PHP kods ieks html


Snaip3Rs

Recommended Posts

Domājat noteikti pēc virsraksta ka nemāku php ielikt iekš html! Bet tas ir maldīgi zinu, kad kādreiz biju taisījis tādu lietu kā ir garš php fails un negribas visu to atkārtot kā lai izvada no tā garā koda piemēram vienu daļu sakuma html kodam otru daļu vidu un trešo lejā! piemēram starp <h><h> gribu ielikt $player lai no lielā koda izvada player niku uz to html kodu!

Link to comment
Share on other sites

takā esmu iesācējs laikam sapratu :D

<!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></title>
</head>

<body>
tavi html kodi
<? print "php kodi"; ?>
citi html kodi
<? print "citi php kodi"; ?>
vel citi html kodi
<? print "vel citi php kodi"; ?>
</body>
</html>

Link to comment
Share on other sites

Bībelē manuālī/dokumentācijā ir rakstīts...

 

1) Koda gabalos, kuros nav HTML, bet ir tikai PHP - nav jānoslēdz kods ar ?>;

2) Ir jāizmanto <?php, jo develop stadijā viss kas var atgadīties (arī mainīties serveri), production stadijā varam elementāri find->replace ar <?.

Link to comment
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...