Results 1 to 3 of 3

Thread: Oop & Php

  1. #1
    Join Date
    Oct 2008
    Posts
    30

    Oop & Php

    I am a bit novice in PHP. Trying to create a design that is one and the same for all pages. So far I did this:
    Code:
     class dynamicPage ( 
    	  var $ title; 
    	 
    	   / / constructor 
    	  function dynamicPage ($ tit) ( 
    	  $ title = $ tit; 
    	
    	  ) 
    	
    	  function beginPage () ( 
    		  echo ( '<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">'); 
    		  echo ( '<html xml:lang="de" dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="de"> <head>'); 
    		  echo ( '<meta http-equiv="content-type" content="text/html; charset=UTF-8">'); 
    		  echo ( '<title>'. $ title. '</ title>'); 
    		
    	  ) 
    	
    	  function setTitle ($ tit) ( 
    	   $ title = $ tit; 
    	  ) 
    	  function endPage () ( 
    	
    	  ) 
    	  function getTitle () ( 
    
    	  return $ title; 
    	  ) 
    	
    
      )
    In index.php:
    Code:
     <? php 
       
        require_once ('../ libfirm / SQLFactory / dynamicPage.php '); 
        $ page = new dynamicPage ( "blaa"); 
        $ page-> beginPage ();  
     ?>
    The problem is that after setting up this subject it ask the name of the page and does not generate its behalf words <title> </title> is empty.

  2. #2
    Join Date
    May 2008
    Posts
    2,015

    Re: Oop & Php

    Code:
     class dynamicPage ( 
    	  var $ title; 
    	 
    	   / / constructor 
    	  function dynamicPage ($ tit) ( 
    	  $ this-> title = $ tit; 
    	
    	  ) 
    	
    	  function beginPage () ( 
    		  echo ( '<! DOCTYPE HTML PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">'); 
    		  echo ( '<html xml:lang="de" dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="de"> <head>'); 
    		  echo ( '<meta http-equiv="content-type" content="text/html; charset=UTF-8">'); 
    		  echo ( '<title>'. $ this-> title. '</ title>'); 
    		
    	  ) 
    	
    	  function setTitle ($ tit) ( 
    	   $ this-> title = $ tit; 
    	  ) 
    	  function endPage () ( 
    	
    	  ) 
    	  function getTitle () ( 
    
    	  return $ title; 
    	  ) 
    	
    
      )

  3. #3
    Join Date
    Oct 2008
    Posts
    30

    Re: Oop & Php

    Ah, thats good. Thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •