Index - PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KDD8
Forum Newbie
Posts: 2
Joined: Mon Feb 28, 2011 7:50 pm

Index - PHP

Post by KDD8 »

The portion that is commented out, for some reason won't generate the page when it's implemented.. It doesn't break, but anything after that doesn't function - Any advise?

Code: Select all

<?php
	require_once('Template.php');
	class Page {
		protected $content = '';
		
		public function __construct() {
		
		}
		
		public function setContent($html) {
			$this->content = $html;
		}
		
		public function generate() {
				
			$mtmpl = new Template();
			$mhtml = $mtmpl->build('menu.tmpl');
			
			$mltmpl = new Template();
			$mlhtml = $mltmpl->build('menuleft.tmpl');
			
			$ttmpl = new Template();
			$thtml = $ttmpl->build('top.tmpl');
			
			$ptmpl = new Template();
			$ptmpl->menu = $mhtml;
			$ptmpl->menuleft = $mlhtml;
			//$ptmpl->top = $ttmpl;
			
			$ptmpl->content = $this->content;
			print $ptmpl->build('page.tmpl');
		}
	
	
	
	}
?>
KDD8
Forum Newbie
Posts: 2
Joined: Mon Feb 28, 2011 7:50 pm

Re: Index - PHP

Post by KDD8 »

Solution: $ptmpl->top = $ttmpl;
should be $ptmpl->top=$thtpml;
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Index - PHP

Post by Weirdan »

KDD8 wrote:Solution: $ptmpl->top = $ttmpl;
should be $ptmpl->top=$thtpml;
You seriously need to improve your variable naming skills.
Post Reply