Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

PHP performance question -


wondering better performance. site viewed people logged in , people not. site same users logged in except have more privledges. wondering more efficient.

//option one

if(isloggedin()){ write whole web site plus content logged in user can access } else { write whole website again, minus content logged in users can access.  }  //option 2 write website content , inset login function wherever need restrict access, function called few different times. 

i wondering if better performance using option 1 because function first checked once, , wouldn't need checked again, if user logged in first chunk loaded, if user not logged in, ignore first chunk , load second chunk.

both.

you don't want check isloggedin() everytime (especially if it's going hit database) because slow. don't want have 2 versions of html either because it's unmaintainable.

check once @ top , set variable (or use session variable , check that). in html use if statements against variable determine show. example:

php:

$logged_in = false; if(isloggedin() ) {      $logged_in = true; } 

html:

<?php if($logged_in) { ?> <div>      super-secret needs login stuff </div> <?php } else { ?> <div>      sorry! have login see cool stuff </div> <?php } ?> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -