Jump to content

birbal

Members
  • Posts

    2,543
  • Joined

  • Last visited

Everything posted by birbal

  1. I think the reason for that is some facebook some core feature is tightly dependent on JS (imagine news feed does not update realtime friend interaction which was main concept of FB to know what friends are doing). so it make JS mandatory even where fallback would do the same job without much of cons. Yes it is possible to simulate realtime update by non JS method but those would not be optimised or user friendly. Its more about UX. Also now these days it is more likely unusual to not having JS support or JS disabled in modern browser for desktop. Also facebook has less UX feature rich web site for old mobile access which does not depend on JS (Which is kind of fallback itself). They want to access the website exactly how they wanted to be. If you want to use it, you can't disable JS.
  2. memcache is suitable for distributed system like where you have to maintain cache for different server. Memcache is server it uses network protocol to talk with php, in general accessing network protocol is slower than direct memory acceess. and also memcache uses serialization internally for other than primitive data type.
  3. another way could be use APC. APC use shared memory so it is faster and persist between request. as your data is temporary (assuming it is not so vital like kicking user for some time) it would get the job done. Remember if server restarts or cache cleared it will lost its data. you can make an array. you will push the id of the kicked user in the array. and serialize and desirialize back and forth in APC cache. after that it would be easy to check if current user is in kick list or not. You can have database and apc together too to maintain data consistency and performance. it is common practise to use APC cache to share the load of database.
  4. You can start it from the tutorial. XML is not complicated at all. xml is just markup structure. The important thing you need to see is the API to parse that file http://php.net/simplexml. Start out with the xml and make the structure of your site in xml. once you have the xml move on to next part, parsing.
  5. You can make a fallback to php. like you can set a event handler on submit button it will send an ajax request and returns false (which will prevent default behaviour of submit button). your action attribute of form should be same as you would do without any JS (when you request using AJAX you will get the action attribute from the form and parse it to make a request header). so in case JS is disabled submit button wont return false and the form will work as usual. same can be done in other case like adding textarea dynamically. in which case if js is disabled php will add textarea and response with the whole HTML.
  6. yes. but i am not sure what is the exact question?
  7. You can store the component in XML structure which will represents the data of the web page. In html page you will only have just templates of html structure. you can use simplexml to load the xml file and inject them inside the html content. you can easily switch between different XML file. In that way you only need to keep track of XML file to add new languages. There is also a way to use XSLT (server side or client side) to transform xml file directly to HTML but that would require knoledge of XSLT.
  8. it is the components of MVC framework. there is plenty of resource if you google about model-view-controller. It is mainly used to keep seperate the data and visual layer.
  9. facebook edit page does not work only with JS. it has PHP in backend to work with the data. JS (AJAX) is used to pass the data to server. after that the data is handled normally as it would do with normal http request
  10. just mark the user in session variable. like $_SESSION['kicked']=true. Where the user will interact and you want to keep kicked user away. check that session variable in those pages.
  11. You are concatenating both of them everytime
  12. foreach will traverse the index which is already exists. So it will never return false. You can though maintain an list of array of fields which are required and check against the $_POST or $_GET if it has been set or not. there is also option for required flag in filter_var() http://php.net/filter_var
  13. absolute pathC:/user/some/file/path/in/windows/user/some/file/path/in linux or relative path calling from user directoryfile/pathwill get you C:/user/some/file/pathetc
  14. make sure you have error displaying is enabled to show all error.Change your php.in directivei "Error_Reporting":E_ALL|E_STRICT (<php 5.4) and E_ALL (from above php5.4 )Error_display":on
  15. if you want to do it dynamically you need to use JS DOM. get the source of the clicked image and replaced the source of main image with that. If you want to do in PHP you can also set a link on image strip (small image) which have GET a parameter which holds the source of it self (or just the name of the file if images are in same location. using file name would be better for validation and security as it will have lesser scope of access of your filesystem.Always give least permission which is enough to get the job done). and Big picture will be set to print that GET parameter to use it source of that image. you can have set a default image for big picture if GET parameter is not set or invalid.
  16. birbal

    SEO

    And how much does have impact on SEO for not using preety URL for dynamic link? I know It is good to be verbose the link for SEO but as far i can remember probably i read somewhere that now webmaster can register GET key for a site to make it verbose (or something like that). I searched the web but could not find anything to backup it. I want to know if sitemap of dynamic link have less impact rather than sitemap of static preety print URL.
  17. use local path of server instead of web path using http
  18. Exception wont stack up error messages if Errors are in same level. Exception is good for error handling as you can catch anywhere in call stack to handle error. But if you want to show stacked error Exception would not be good. like if you have registration page and you want to show user same time about invalid nick and invalid password same time using exception for both case it would not show two errors if you throw two of those errors from same call stack(method call,function call). as soon it encounters exception it will stop executing and keep on going upward of call stack until it finds a suitable exception handling catch block. The other exception is not even thrown, rest of the code will not be executed. So in those case you could collect the errors and make up a combined error to get thrown by an exception. 'Exception' is generic you would want to extend it to any specific exception to identify them, eg, 'UserGeneratedException'. Exception is best suitable for handling unexpected error. You would usually use exception to handle the unexpected occurance rather than just for error displaying directly.
  19. Start adding debug statements, echoing mysql error. If it is not executing the query it would say why. does code A is exact copy of the code you are executing?
  20. birbal

    SEO

    Does google using only sitemap to index dynamic pages? or is there more anything else i am missing?
  21. you should check the value which you are using to compare in if statement. have you checked how many rows it is printing? You can also copy paste the query in phpmyadmin to see the results instantly.
  22. It is actually HTML5 , the latest standard. It is not like that previous version of HTML (version 4) wont work , it is not just best practice. Some of tags from HTML4 also exists in HTML5. some of HTML4 tags are deprecated which are not good to use. It is the DOCTYPE which tells which version and mode of HTML a page is using. html code with wrong DOCTYPE will show errors when you validate it. Deprecation happend because there is other better usage of it or it is not used as likely it should be. <font> tag is depcreated in favor of CSS. It is best preactise to keep seperate the HTML and css. HTML should not be used for styling, only markup. CSS is there for styling. The modern browser does not implemented the HTML5 standard fully some of them may be unavilable or partialy implemented in certain browser. though most of html tags are avilable in modern browser.
  23. No it will not send the data evrytime. unless you are using mysql_query() it wont send the query to database. $sql is now just a bunch of string and according to your code you are not executing the INSERT query. If the posted code is exact identical to your original code there is no way to happen INSERT
×
×
  • Create New...