user2292286
user2292286

Reputation: 51

Multiple Sections on One Webpage

I'm a total programming beginner trying to absorb HTML, PHP and MYSQL. This is my first question.

I plan to build a site that has an "admin" part and a registered user/member section that are displayed at the same time.

To give a better picture, think of YELP where there is the a part for the business-establishment's section on top and the reviews on the lower section. The difference is that the business owner/admin can access/edit the business section but will NOT be able to do so on the review part; vice-versa for the review/member-user on the bottom.

How should I plan to do the layout? WIll they be put together with two different PHP code under one html page?

Could someone please provide a layout-structure as guidance?

Example

<html>
<?php
include( businessowner_admin.php); //with all the validations etc.

inlude(registered_member.php); //with all the validations etc.

?> 
</html> 

Am I on the right path? Or is CSS needed to handle this?

Thanks Katy

Upvotes: 3

Views: 1022

Answers (1)

J0HN
J0HN

Reputation: 26921

[preach mode on]

I think you're following the wrong way. It's generally a bad idea to have two almost completely unrelated set of functionality on a single page. And, an overall problem with PHP is that it makes incredibly easy to follow bad coding standards.

So, instead of providing you a good layout so you could toss in bad code (don't get it offensive, step one in every programmer's development - write bad code :))

  1. Study PHP the right way
  2. Invest some amount of time into studying some well-known well-designed PHP MVC frameworks (e.g. Symfony, Yii or Zend).
  3. Learn HTML and CSS (google for CSS or HTML tutorial - tons of them).
  4. Get aquinted with some good text editor like Sublime Text2 or Notepad++ (hardcore programmers will recommend vim or emacs - don't listen to them yet. Those are powerful beasts, but require huge amount of effort to learn and, hm... adopt them :))
  5. Learn some database basics (if you're not sure - start with MySql) and how to couple it with PHP (never use mysql_[something] PHP functions - they are deprecated. Use mysqli or pdo first, than move to some ORM frameworks, like Doctrine2).
  6. Finally, learn javascript (e.g. on codeacademy) and some good javascript framework (jQuery is de-facto "standard").

All those mentioned instruments and techniques are free of charge, so the only resource required is your time, not money.

Move one step at a time. This path, walked the proper way, should not take less than a couple of months. But at the end you're going to be skilled wed-developer, suitable for the majority of the tasks.

[preach mode off]

As for the question, you'd better separate the "admin" and "frontend" pages, so you could manage access, content and styling easier. So, you could use some common parts, like header/footer, menu, etc. as an includes on those pages, but the pages itself better be separate in my opinion (and still, you'd better learn and use some

Upvotes: 4

Related Questions