freebsdntu Posted December 16, 2007 Share Posted December 16, 2007 Hi guys,I am having a bit of design doubt here. Should I write all the code in php file? Or should I present the presentation(i.e. forms) in plain html file and create another php file for the server-side functionality(i.e.form handling?)? Which approach is better? Any hints? Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted December 16, 2007 Share Posted December 16, 2007 I've been starting to create everything in php files. That doesn't mean everything has to be php, but in the event that you want to add php to a page later, it is easier to have the page already set up for it. That way you don't have to use 301 redirects and worry about changing links in your other pages. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 16, 2007 Share Posted December 16, 2007 Generally I'd say it's best to separate template from the rest of the code. Makes it easier to maintain IMO. Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 16, 2007 Author Share Posted December 16, 2007 Thank you for both of your inputs,sKunKbad and Daniel0. By the way,daniel, template? What do you mean by that? Like css? or other html template? Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 16, 2007 Author Share Posted December 16, 2007 Oh,by the way,sKunKbad.If all put in php,do you do it like this?(use php also to echo the html elements) <?php echo "<html></html>" ?> or like this?(php embeded in html where neccessary) <html> <?php ?> </html> Quote Link to comment Share on other sites More sharing options...
flamerail Posted December 16, 2007 Share Posted December 16, 2007 Oh,by the way,sKunKbad.If all put in php,do you do it like this?(use php also to echo the html elements) <? php echo "<html></html>" ?> or like this?(php embeded in html where neccessary) <html> <?php ?> </html> No you would not need to. You can simple put the html into the php and put bits of <? phpstuff ?> where ever. You can even do stuff like, <?php if($a=0){ echo "hah"; ?> html STUFF!!! RAW HTMLZZ1!11! <?php } else { echo "Nahh to lazy for more html"; } Hope you understand. Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 16, 2007 Author Share Posted December 16, 2007 thank you very much,flamerail,now I got it! Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 16, 2007 Share Posted December 16, 2007 By the way,daniel, template? What do you mean by that? Like css? or other html template? I mean anything which describes the view. Take a look at frameworks like CakePHP and CodeIgniter to see what I mean. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.