Jump to content
php.lv forumi

Vai šādi drīkts darīt?


Wuu

Recommended Posts

<?php session_start(); ?>
<html>
<head>
 <title>Bilzu Galerija</title>
<meta http-equiv='content-type' content='text/html; charset=utf-8'>
<meta name='author' content='xxxxxxxxxxxxx'>
<meta name='description' content='Portfilio'>
<meta name='keywords' content='Fotografijas'>
  </head>
 <body>
<?php if (empty($_SESSION['admin'])) { ?>
	<div align='center'>
	<form name='loginform' method='post' action='login.php'><br>
	Password<br><input type='password' name='password' class='textbox' style='width:80px'><br>
	<input type='submit' name='login' value='Login' class='button'><br>
	<input type='submit' name='logout' value='Logout' class='button'><br>
	</form>
	</div>
 <?php  } ?>
 </body>
</html>

Link to comment
Share on other sites

Aizliegts nav.

Nu jā ,bet vai nav kāds ļaunums tur lenāks kods vai kas cits gribu iemācīties pareizi!

Izlasīju ka viss kas var būt statisks lai labāk ir ,bet daudz sanāk to <?php ?> močīt iekšā :(

Kā labāk?

Link to comment
Share on other sites

Tavā gadījumā varētu nebūt nozīmes ( cik daudz cilvēku nāks un noslogos, lai justu kaut kādu bremzi? ). Bet principā lielus apjomus plika HTML daudz labāk ir nedrukāt ar PHP, tā kā tev šeit ir uztaisīts.

 

When you need to output a large or even a medium sized static bit of text it is faster and simpler to put it outside the of PHP. This will make the PHP's parser effectively skipover this bit of text and output it as is without any overhead. You should be careful however and not use this for many small strings in between PHP code as multiple context switches between PHP and plain text will ebb away at the performance gained by not having PHP print the text via one of it's functions or constructs.
Link to comment
Share on other sites

×
×
  • Create New...