{"id":501,"date":"2015-01-05T10:33:20","date_gmt":"2015-01-05T10:33:20","guid":{"rendered":"http:\/\/www.cakephpexpert.com\/blog\/?p=501"},"modified":"2015-11-27T12:58:25","modified_gmt":"2015-11-27T12:58:25","slug":"overcome-common-beginners-hurdles-with-cakephp-development","status":"publish","type":"post","link":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development","title":{"rendered":"Overcome Common Beginner\u2019s Hurdles with CakePHP Development"},"content":{"rendered":"<p>You develop sites and most of the times you find tricks to do things faster and with better control ever than before. But this happens only with time when you gain some experience working on a web technology.<!--more--> You can think of many situations where you must have not known what you should do to make things right as a beginner. As a CakePHP newbie, these points will help you overcome common hurdles you face as a beginner:<\/p>\n<p><a href=\"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-503\" src=\"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg\" alt=\"Beginners Cakephp Hurdles\" width=\"740\" height=\"350\" srcset=\"https:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg 740w, https:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350-300x141.jpg 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><\/p>\n<p><strong>Incorrect Filenames<\/strong><\/p>\n<p>As a beginner, you would face this problem quite regularly. Whether to write a filename with or without an\u2018s\u2019 at the end is quite a task for you at the starting. To <a title=\"Top 10 Errors of Web Development You Should Avoid\" href=\"http:\/\/www.cakephpexpert.com\/blog\/top-10-errors-of-web-development-you-should-avoid\">avoid this mistake<\/a> to appear again and again, try to stick to the basic rules. Always remember two things. Firstly, controllers are always plural. For e.g. users_controller.php. And secondly, Models are singular, e.g. user.php.<\/p>\n<p><strong>\u2018echo\u2019 in views<\/strong><\/p>\n<p>If you are not using echo, your program can skip to have form helper while you are building a form and this can be quite bothersome for you as a newbie.<br \/>\nAvoid this little hurdle by just adding this small piece of code to your plain HTML code:<\/p>\n<p><em>&lt;div&gt;<\/em><\/p>\n<p><em>&lt;?php\u00a0echo\u00a0$some[&#8216;array&#8217;];\u00a0?&gt;<\/em><\/p>\n<p><em>&lt;\/div&gt;<\/em><\/p>\n<p>Instead of writing<\/p>\n<p><em>&lt;?php<\/em><\/p>\n<p><em>echo\u00a0&#8216;&lt;div&gt;&#8217;;<\/em><\/p>\n<p><em>echo\u00a0$some[&#8216;array&#8217;];<\/em><\/p>\n<p><em>echo\u00a0&#8216;&lt;\/div&gt;&#8217;;<\/em><\/p>\n<p>This does not just help you get the required help module right in place but also helps you increase productivity by helping you take charge of IDEs better and get better response with codeformatting.<\/p>\n<p><strong>Correct paths to images<\/strong><\/p>\n<p>HtmlHelper needs to be implemented and used well to avoid problems fetching images from their sources. It will create the right path for your picture to help it reach the destination accurately even if the site structure in not placed properly. Or else, the time you use standard html img tag, it could contain some issues with the view because of which problem in viewing image could appear.<\/p>\n<p><strong>Unexpected results in ajax calls<\/strong><\/p>\n<p>One of those painful ones to have. You see all logics placed right but still things are not working as they should. You can face it most of the times creating a new method if you don\u2019t check your debug level.<\/p>\n<p>Putting this code would help and lot and will save you from wasting too much of time:<\/p>\n<p><em>function\u00a0foobar()\u00a0\u00a0{<\/em><\/p>\n<p><em>configure::write(&#8216;debug&#8217;,0);<\/em><br \/>\n<em> \/\/\u00a0somthing\u00a0happens\u00a0here<\/em><\/p>\n<p><em>}<\/em><\/p>\n<p><strong>Nice urls<\/strong><\/p>\n<p>Try using url names that the database and name conventions suggest and not the ones that attract you. Just make things work out first and then go for nice urls. Just don\u2019t waste your time thinking about the appealing names at first. Just continue with the flow. Once you are done with coding routes, it will automatically do it for you when you build it with the help of HtmlHelper.<\/p>\n<p>I also used to put the query in the controller as it seemed quite easy and didn\u2019t trouble me in anyway, as happens with most of them in the beginning. But steadily as I turned mature with <a title=\"Cakephp development\" href=\"http:\/\/www.cakephpexpert.com\/services\/cakephp-web-development\">CakePHP development<\/a>, I came to know that this will not keep the structure clean. To have everything right in control put everything in the model to which it belongs and acquire data from there. This way the controller will stay lean and that will help you keep everything organized, most easily!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You develop sites and most of the times you find tricks to do things faster and with better control ever than before. But this happens only with time when you gain some experience working on a web technology.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27,16,12],"tags":[60,111],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Overcome Common Beginner\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Overcome Common Beginner\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog\" \/>\n<meta property=\"og:description\" content=\"You develop sites and most of the times you find tricks to do things faster and with better control ever than before. But this happens only with time when you gain some experience working on a web technology.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development\" \/>\n<meta property=\"og:site_name\" content=\"Cakephp Expert Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-05T10:33:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-11-27T12:58:25+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/#website\",\"url\":\"https:\/\/www.cakephpexpert.com\/blog\/\",\"name\":\"Cakephp Expert Blog\",\"description\":\"Cakephp Development Company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.cakephpexpert.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg\",\"contentUrl\":\"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#webpage\",\"url\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development\",\"name\":\"Overcome Common Beginner\\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#primaryimage\"},\"datePublished\":\"2015-01-05T10:33:20+00:00\",\"dateModified\":\"2015-11-27T12:58:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/#\/schema\/person\/0f12b00f339dcf099f8431b3ba0db2e1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.cakephpexpert.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Overcome Common Beginner\\u2019s Hurdles with CakePHP Development\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/#\/schema\/person\/0f12b00f339dcf099f8431b3ba0db2e1\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cakephpexpert.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/28e9fe1b5e695a0ed4f8d10cb1186b26?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/28e9fe1b5e695a0ed4f8d10cb1186b26?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/www.cakephpexpert.com\/\"],\"url\":\"https:\/\/www.cakephpexpert.com\/blog\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Overcome Common Beginner\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development","og_locale":"en_US","og_type":"article","og_title":"Overcome Common Beginner\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog","og_description":"You develop sites and most of the times you find tricks to do things faster and with better control ever than before. But this happens only with time when you gain some experience working on a web technology.","og_url":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development","og_site_name":"Cakephp Expert Blog","article_published_time":"2015-01-05T10:33:20+00:00","article_modified_time":"2015-11-27T12:58:25+00:00","og_image":[{"url":"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.cakephpexpert.com\/blog\/#website","url":"https:\/\/www.cakephpexpert.com\/blog\/","name":"Cakephp Expert Blog","description":"Cakephp Development Company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cakephpexpert.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#primaryimage","inLanguage":"en-US","url":"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg","contentUrl":"http:\/\/www.cakephpexpert.com\/blog\/wp-content\/uploads\/2015\/01\/hurdles-740x350.jpg"},{"@type":"WebPage","@id":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#webpage","url":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development","name":"Overcome Common Beginner\u2019s Hurdles with CakePHP Development - Cakephp Expert Blog","isPartOf":{"@id":"https:\/\/www.cakephpexpert.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#primaryimage"},"datePublished":"2015-01-05T10:33:20+00:00","dateModified":"2015-11-27T12:58:25+00:00","author":{"@id":"https:\/\/www.cakephpexpert.com\/blog\/#\/schema\/person\/0f12b00f339dcf099f8431b3ba0db2e1"},"breadcrumb":{"@id":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cakephpexpert.com\/blog\/overcome-common-beginners-hurdles-with-cakephp-development#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cakephpexpert.com\/blog"},{"@type":"ListItem","position":2,"name":"Overcome Common Beginner\u2019s Hurdles with CakePHP Development"}]},{"@type":"Person","@id":"https:\/\/www.cakephpexpert.com\/blog\/#\/schema\/person\/0f12b00f339dcf099f8431b3ba0db2e1","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/www.cakephpexpert.com\/blog\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/28e9fe1b5e695a0ed4f8d10cb1186b26?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28e9fe1b5e695a0ed4f8d10cb1186b26?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/www.cakephpexpert.com\/"],"url":"https:\/\/www.cakephpexpert.com\/blog\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/posts\/501"}],"collection":[{"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/comments?post=501"}],"version-history":[{"count":8,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":779,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/posts\/501\/revisions\/779"}],"wp:attachment":[{"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cakephpexpert.com\/blog\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}