A help with design

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

User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

That won't work because each individual map has a different variable for percentage and records, etc. :S
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Yes, this is what you ought to do. It seems to be exactly the same html each case (if the html wasn't identical you would create as many html templates as you need).

Echo vars with the same names in the template. Set them in the script then just include the template.

Models (logic & vars) and views (html & formatting) are best kept separate.
eletrium
Forum Commoner
Posts: 34
Joined: Tue Feb 10, 2004 3:38 pm

Uh

Post by eletrium »

If you're claiming my refactor won't work, look again. It is creating a function (which you will have to be sure is the proper way to do it in PHP) and passing the information specific to each case into the function.

This is as simple as it gets.

As McG is saying, it is separating the View logic from the Control/Model logic... re-read it. I am passing in the vars specific to each case. Simple stuff...
Post Reply