| | |
What is the best technique
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hi and I have learned 2 ways of making a php cms both with simular results on the client side. That is, is it best to have all pages pointed to index.php with mod rewrite and url vars or is it best to have a couple dozen php files each including the styles. Previously I have just placed all my code into the index.php and used mod rewrite to send all url requests to index.php but am now thinking that it might be better to have a login.php and logout.php etc. Which of this techniques do you think is best?
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
1
#2 Oct 20th, 2009
I use a mixture of both. Kind of.
All my calls a centralized around index.php. My url rewrite changes urls like http://www.mysite.com/page/index to index.php?url=page/index. Then my url class grabs $_GET['url'] and process it.
My page class loads the proper page from my php folder hidden above the doc root. That ways its organized and hidden.
My file structure:
/private - above the doc root
---- /classes - specific site classes here (like user classes)
---- /css - all css files
---- /javascript - all js files
---- /lib
---- ---- /classes - all main classes (like database, html, ect.)
---- /php - all php files go here. the page class loads them from here.
---- /templates - all templates go here
/public_html
index.php
Thats how my framework is setup. It has worked nicely. I can attach the framework files so you can see how I do it.
All my calls a centralized around index.php. My url rewrite changes urls like http://www.mysite.com/page/index to index.php?url=page/index. Then my url class grabs $_GET['url'] and process it.
My page class loads the proper page from my php folder hidden above the doc root. That ways its organized and hidden.
My file structure:
/private - above the doc root
---- /classes - specific site classes here (like user classes)
---- /css - all css files
---- /javascript - all js files
---- /lib
---- ---- /classes - all main classes (like database, html, ect.)
---- /php - all php files go here. the page class loads them from here.
---- /templates - all templates go here
/public_html
index.php
Thats how my framework is setup. It has worked nicely. I can attach the framework files so you can see how I do it.
Last edited by kkeith29; Oct 20th, 2009 at 2:55 am.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
0
#3 Oct 20th, 2009
Wow, that changes how I think about designing php. I noticed you have a templates directory. Does this mean that there are multiple php files displaying the same template includes from that directory or is it just the index.php that uses the template includes?
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
0
#4 Oct 20th, 2009
Here are the files from my current project so you can see how it works. Its easier to show you than explain.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
0
#5 Oct 20th, 2009
I just checked the code and so oopedy loopedy. As hard as it may be bouncing between the includes/require files I managed to understand the concept. I noticed that nearly all the php code was placed outside the public viewing directory which I have seen the reasons explained before. But all of the php files? Is there an advantage to this or should I only place files that need to be secure outside the web directory because some of the php files would include the banner, footer, menu each in a separate file (I think) so would all of those go above the web directory and be included in index.php? Thanks.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
![]() |
Similar Threads
- Best technique? (Search Engine Optimization)
- best marketing technique (Advertising Sales Strategies)
- link to us technique. Good or bad? (Search Engine Optimization)
- need help in Face Detection Technique (Computer Science)
- A Question of Technique (PHP)
- Hashing Technique: Division Method (C++)
- better way or technique to write this (Assembly)
- Visualisation Technique (Graphics and Multimedia)
Other Threads in the PHP Forum
- Previous Thread: Create a sort by link (wordpress/php)
- Next Thread: PHP Scheduled Problem
| Thread Tools | Search this Thread |
# 5.2.10 action address apache api array auto autoincrement beginner binary broken cakephp checkbox class classes cms code cron curl database date dehasher destroy display dissertation domain dynamic echo echo$_get[x]changingitintovariable... email error errorlog fatalerror file files folder form forms function functions google href htaccess html if-else image images include insert ip javascript joomla legislation limit link load login mail masterthesis menu mlm multiple mysql mysqlquery oop open paypal pdf persist php popup problem query radio random record recursion remote script search server sessions sms sockets source space sql syntax system table tutorial update upload url validator variable video web youtube






