Thursday, October 16, 2014

Install CodeIgniter Framework


In this post we will cover how to install codeigniter framework and we will view the most common steps to install codeigniter framework. CodeIgniter is one of the most popular PHP frameworks around. It uses the Model-View-Controller Architectural design pattern and it’s considered by lots of PHP developers as one of the best framework solution for small to medium projects.

How to Install

The installation itself is such a simple process. First of all, you need to download the CodeIgniter zipped file, upload it to your server and extract it into your home directory. You can download it from https://ellislab.com/codeigniter/user-guide/installation/downloads.html.

Configuring CodeIgniter

Congratulations, now you have CodeIgniter installed on your server. Now it’s time for configuration. Open the application/config/config.php file with your preferred editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. For the database configuration, open the application/config/database.php file with your preferred editor and set your database host, name, user, password and other values that you think it will help you connect to your database. You will find array variables with comments to know the role of each value.

Configuration files

By editing the two previously mentioned files, you are ready to start coding your first web application but CodeIgniter contains more files that enable more configuration and customization abilities. The configuration files can be found in the application/config/ directory. The following is a quick description of what you can do by editing some of the most commonly used configuration files:

autoload.php : specifies which systems (Packages, Libraries, Helper files, Custom config files, Language files and Models) should be loaded by default.

config.php : contains all website configuration.

constants.php : contains defined constants which are used when checking and setting modes when working with the file system.

database.php : contains the settings needed to access your database.

email.php : This file is not created by default. But you can create it and set the default values for the email class. Like: mailtype, charset, newline, protocol, smtp_host, etc.

hooks.php : lets you define “hooks” to extend CI without editing the core files.

mime.php : contains an array of mime types. It is used by the upload class to help identify allowed file type.

routes.php : lets you re-map URI requests to specific controller functions.

smileys.php
: contains an array of smileys for use with the emoticon helper.

upload.php : This file is not created by default. But you can create it and set the default values for the upload class. Like: upload_path, allowed_types, max_size, max_width, max_height, etc.

user_agents.php : contains four arrays of user agent data. It is used by the User Agent Class to help identify browser, platform, robot, and mobile device data. The array keys are used to identify the device and the array values are used to set the actual name of the item.

Monday, October 6, 2014

php To PDF

php To PDF is an API based solution. We are a web service providing you the easiest way to generate PDF files from PHP Code.

Our server does the heavy lifting and generates the PDFs for you. The generated PDF files will be returned and stored on your server in the specified directory with your specified file name, or you can set them to be created and displayed or downloaded by a user on the fly.

You do not need any special packages or permissions. It works on any server running PHP!

We have simplified our API so that you just need to download the phpToPDF.php file from your account and include it in your code. It's that simple.

Get started :: PHP to PDF generation steps
Sign up to access our API   
2  FREE!
Download and include phpToPDF.php

Sample Code

Use the phptopdf() function for creating a PDF using a URL



<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


    require('phpToPDF.php');

    //Set Your Options -- see documentation for all options
    $pdf_options = array(
          "source_type" => 'url',
          "source" => 'http://google.com',
          "action" => 'save');

    //Code to generate PDF file from options above
    phptopdf($pdf_options);
 

?>



Alternatively, you can use the phptopdf() function to pass a varible that holds html code for your PDF.

<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

    require('phpToPDF.php');

    //Your HTML in a variable
    $my_html="

PDF from HTML using phpToPDF

"; //Set Your Options -- we are saving the PDF as 'my_filename.pdf' to a 'my_pdfs' folder $pdf_options = array( "source_type" => 'html', "source" => $my_html, "action" => 'save', "save_directory" => 'my_pdfs', "file_name" => 'my_filename.pdf'); //Code to generate PDF file from options above phptopdf($pdf_options); ?>


[ More Examples ]
 

© 2014 4everTutorials. All rights resevered.

Back To Top