Jump to content
php.lv forumi

PHP 5.3.x un klasses


LorDRameX

Recommended Posts

mekleetaaju nemaaku izmantot (ti nepaliidz)

 

 

sanaaca peec krietna laika izvilkt vecu kodu kura ir izamntot primitiiva mysql klase

 

secinaajums uz 5.3.x nestradaa vairs vinja

 

lapa izdruka kodu iekh html peec pirmaa $this->

 

<?
class adminTool {

   	private $db = array();
   	public function __construct() {
           	$this->db["db_username"] = "root";
           	$this->db["database"] = "database";
           	$this->db["db_password"] = "password";
           	$this->db["hostname"] = "localhost";
           	$this->db["connected"] = false;
           	$this->db["result"] = "";
   	}
   	private function open() {
           	if($this->db["connected"] != true) {
               	$this->db["connection"] = @mysql_connect($this->db["hostname"], $this->db["db_username"], $this->db["db_password"]);
                   	mysql_select_db($this->db["database"]);
               	$this->db["connected"] = true;

 

apstraade tiek norauta pie $this->db['db_username'] = 'root'; un tiek izdrukaats db['db_username'] = 'root'; un viss atlikushais kods

 

iesperat mulkjim kura virzienaa mekleet, kas ir mainijies (PS PHP neesmu izmantojis nopietni gadus triis :/ tapec nezinu kas ir mainiijies pa sho laiku)

Link to comment
Share on other sites

hmm, laikam jau ta sanaak, kauak mulkjiigi buus japamekle par ko vinji tik ljauni ar short open tag apgajaas, daudz vietas koda ir short echo etc :/

<?=$foo?>

 

naksies pakasiit pakausi via tomeer iiesleegt short open tags ieksh settingiem vai parrakstiit visu :/

Link to comment
Share on other sites

Es un mani kolēģi esam vienojušies izmantot _alternative syntax_ iekš skatiem... tas izskatās:

 

<?php if (true): ?>
   <!-- HTML -->
<?php endif ?>

<?php for ($i = 0; $i < 10; ++$i): ?>
   <!-- HTML -->
<?php endfor ?>

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...