Skip to main content

Posts

How to Create a PDF file in Cakephp 2.0 using Fpdf

Step 1: Download FPDF folder from  http://www.fpdf.org/  . Step 2: Unzip the downloaded Fpdf file and name it “fpdf” or however you require and make sure that you use the same name while calling it. Step 3: Move the “fpdf” unzipped files to  your /app/Vendor directory within Cakephp. Now you should have the directory path as   /app/Vendor/fpdf. Step 4: Create a new Cakephp layout file for the pdfs. We will use this layout when serving a pdf to the client. Create a file called pdf.ctp inside of /app/View/Layouts. Add the following code to /app/View/Layouts/pdf.ctp Layout: /app/View/Layouts/pdf.ctp 1 2 3 4 <?php      header ( 'Content-Disposition: attachment; filename="downloaded.pdf"' ) ;      echo $content_for_layout ; ?> The header function above tells the browser that it is going to receive...

Optimise Search Results - Elastic Search

Although Elasticsearch offers an efficient scoring algorithm, it may often be inadequate in e-commerce contexts. Most users tend to care only about the topmost number of results. which means that it’s very important to have a flexible scoring mechanism. If you can present the topmost results according to user preference, then your conversion rate is likely to increase significantly. In this article, we’ll look at the default scoring configuration in Elasticsearch, and we'll also walk through several customizations to the scoring. This knowledge can help you achieve a user-customizable list of results. By default, Elasticsearch makes use of the Lucene’s practical scoring formula, which represents the relevance score of each document with a positive floating-point number known as the _score . The higher the _score, the higher the relevance of the document. A query clause generates a _score for each document, and the calculation for that score depends on th...