What is the best technique

Reply

Join Date: Sep 2007
Posts: 1,456
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

What is the best technique

 
0
  #1
Oct 20th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
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.
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,456
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
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.
Attached Files
File Type: zip framework.zip (68.8 KB, 6 views)
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,456
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso
 
0
  #5
Oct 20th, 2009
Originally Posted by kkeith29 View Post
Here are the files from my current project so you can see how it works. Its easier to show you than explain.
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso
 
0
  #6
Oct 21st, 2009
Most of it is personal preference. Configuration files are really the only thing that needs to be protected.
Google is your friend.

Use [code] tags.

If you have found a solution to your problem, please mark the thread as SOLVED.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC