Welcome! Log In Create A New Profile

Advanced

page design and code location

Posted by snymanth 
Announcements Last Post
Announcement : Programming Students at UNISA School of Computing 06/19/2019 02:01PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
page design and code location
October 15, 2011 01:26PM
Hi Mac

I just want some clarification on how the pages for the app should be designed and in which pages exactly the code should be located?

In the tut letter it is specified:

"Note that you only have 4 admin pages, therefore all code related to managing the course (MC1 -> MC2) must fit in course_man.php. It follows that you must make use of if/else or case to manage how code is handled."

I for example have designed my application as follows:
course_man.php presents a list of courses with links to add, edit or delete. Clicking on one of the links take the user to a different php page where the info relating to the action is inserted (for example course_update.php). The actual update or delete in the database then occurs in this page.

Is this acceptable or is it critical that all the code relating to managing the courses be located inside course_man.php? This would then imply that we must have one php page generating different forms depending on what link is clicked? It does complicate things a bit...

Thx for the assistance.

SN: 77373340
avatar
Mac
Re: page design and code location
October 17, 2011 06:54AM
The more pages the more effort to manage the site. There is nothing worng with doing it the way you are doing it, but having all the code on one page and using an if/else is much easier!
Re: page design and code location
October 17, 2011 08:36PM
Hi Dr

Thx for the reply. I was wondering what options there are available to make sure that everything is still kept rather simple, easily readable and understandable. Especially in terms of troubleshooting. Having 1 page with so much info on means it can become a bit of a mess. Obviously making use of includes and as much as possible functions is supposed to be priority in order to achieve the aforementioned.

In terms of writing the page so that different html get's generated based on what input the user gives. The aforementioned would imply a lot of html inside a PHP section. As far as I am aware there are only 2 options to do this. Either printing out each html line or using the heredoc syntax.
Heredoc syntax is nice but is required to be right to the left of the page. This results in code unneatness. Even printing every html line provides for a lot of unnecessary code.

I would just like your and some of the other guys opinion on this. What strategy do you guys follow to keep your code neat and logical?
avatar
Mac
Re: page design and code location
October 18, 2011 06:52AM
3 rules:
Indent and space your code properly
Give your variables/functions/etc descriptive names
Comment your code fully
avatar Re: page design and code location
October 21, 2011 08:54PM
I was actually wrestling with the same question, should I spread the code across many pages, therefore less & more purpose specific code in a few pages or do it in as little possible pages with conditional statements. I initially had quite a few pages but have since cut down. Thank you for the tips Mac & for all your support thus far, we all appreciate it!
Sorry, only registered users may post in this forum.

Click here to login