Yii framework pdf

Tuesday, March 5, 2019 admin Comments(0)

The Yii framework has a component-based architecture and a full solid caching support. The Yii framework also uses the latest features of PHP, like traits and. An avid proponent of Yii Framework and open source software, Charles has offers eBook versions of every book published, with PDF and ePub iles available ?. with an introduction to the Yii framework itself, its history and some of the available al- Yii, PHP, frameworks, video streaming, open source.


Author: GLYNIS NODINE
Language: English, Spanish, Portuguese
Country: Oman
Genre: Religion
Pages: 507
Published (Last): 11.12.2015
ISBN: 523-9-70708-822-6
ePub File Size: 21.88 MB
PDF File Size: 15.27 MB
Distribution: Free* [*Regsitration Required]
Downloads: 45418
Uploaded by: SAVANNAH

uncomment to avoid processing of calls to non-existing static files by. Yii. # location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {. # try_files $uri =;. #}. Export menu that allows you to bulk export data as excel, pdf, csv, text, html. Created by A great PDF component for Yii2 based on the mPDF library. Created. This tutorial describes how to use Yii to develop a blog application shown as the blog Tip: The Yii framework can be installed anywhere in the file system, not.

The following commands will allow you to provision a PHP7 Vagrant box: In this chapter, you'll also learn how to create ixtures to represent your data for testing purposes. These method names directly correspond with the SQL segment that they are named after. Furthermore, by following the convention of using underscores in our column names in our user table, Gii has automatically created titleized and readable attribute labels for us: We can do this by creating a repositories block populated with the DCVS information for our module repository and then adding the module to our require block: The from method can also be used to specify a table alias, as shown in the following example: We also illustrated the use of Query Builder, which can enable us to write database-agnostic queries in a programmatic way.

The Gii command The next set of commands in our toolbox is the Gii command. If you are familiar with Yii1, Gii provides the functionality to generate controllers, models, forms, and even basic CRUD functionality.

Framework pdf yii

In Yii2, Gii has been extended from a web application module to both a web and console application and has been enhanced to include additional features as well. The Gii module in Yii2 provides these console commands to automatically generate code: Each of these commands, when supplied with the right options, will generate the respective item identiied by the subcommand.

For a complete list of requirements and options, ensure that you use the help command on the Gii subcommands. As a development tool, Gii has the ability to arbitrarily generate and override existing code in your application. For security purposes, you should conditionally load the Gii module only in your development environment.

Moreover, the Gii module itself should never be deployed to your production environment. For this reason, it is advised that you only load the Gii module in the require-dev section of your composer. The require-dev section is a special section within our composer. By default, running Composer will install all packages in our require and require-dev sections.

In production environments, we will want to exclude our development environments by passing the --no-dev lag to our Composer installation command.

For more information on the Composer CLI, ensure that you reference the Composer documentation at https: In Chapter 11, Internationalization and Localization, we'll go into more depth about how to use these commands to generate PHP message iles and.

We'll also cover the use of the Yii:: The migration command The inal built-in command set with Yii2 is the migration command. The migration commands provide functionalities to generate, apply, revert, and review database migrations. This tool provides these subcommands: For now, use the.

Creating console commands Now that we know what built-in commands Yii2 provides, let's start adding our own commands. If this folder doesn't exist yet, go ahead and create it: First, we'll create a new ile called BasicController.

Now, let's write some PHP code. First, we need to declare the namespace that our BasicController lives in. Next, we'll declare our controller class as follows: Finally, inside our class, we'll create an actionIndex method that will simply output HelloWorld and then gracefully return with a successful error code. By default, the actionIndex method is the method that is called when an action is not speciied to a controller: Now, if we run the help command, you can see that our command appears in the list of available commands: HelloWorld Generating help information While we can now run our commands, the help command for both the global help menu and the action help menu currently doesn't provide any useful information.

In Yii2, this information is extracted directly from the document block comments also known as DocBlock comments that are used before our BasicController class and our actionIndex method. For instance, consider that we add the following before our class declaration: Take, for instance, the following method of our BasicController: Arguments serve as the data that we provide to your actions.

On the other hand, options allow us to specify additional coniguration for our controller in general.

Each console application we create and use may have separate options that we can set. Ensure that you reference the Yii2 documentation for that class and use the help command to determine what options are available for each command.

Without any arguments, this command will throw the following error, indicating that the name parameter is required: Missing required arguments: Alice lives in Chicago. By providing a default value to the city parameter, that option is not required for our command to be executed. However, if we passed a value as the second parameter, it would override our default value as expected: Alice lives in California.

Ensure that you wrap any strings that use special characters in quotes to ensure that the full argument is passed to your application. Take, for instance, the following method: From the command line, we can specify an element as an array by representing it as a comma-separated list: If you need to pass a multidimensional array of data from the command line, you can pass a path to a coniguration ile instead and then load that ile inside your controller action.

While returning from our controller action isn't strictly necessary, it's considered a best practice so that our shell can be notiied whether our console command has been executed successfully or not. By convention, an exit code of 0 indicates that our command ran without errors, whereas any positive integer greater than zero would indicate that a speciic error occurred.

The number returned will be the error code that is returned to the shell, and it can be used by our end users to reference our application documentation or support forum to identify what went wrong. Suppose, for instance, that we wanted to validate one of our inputs without diving into custom forms and validators. If that integer is less than zero, we could return an error code that our documentation would be able to reference: If you have more than one return code, it is considered a good practice to deine meaningful constants in your controller to identify your error code.

BSOURCECODE

Before we can use this helper, we need to import it into our class: While both methods will format text, the ansiFormat method can be used to dynamically combine multiple strings with different formats: We're done! We also covered the seven built-in console commands in brief.

Additionally, we covered how to create our own console commands, how to pass parameters to our command, how to return values properly from within our code, and how to format the output of our commands. In the next chapter, we'll expand our mastery of Yii by learning how to use and write migrations, how to use database access objects DAO , and how to use Yii's built-in Query Builder.

In this chapter, we'll cover how to connect to different databases, write database migrations to instantiate our databases, use database access objects DAO , and use Yii2's built-in Query Builder. We'll also cover the basics of powerful tools such as data providers and data widgets as well as how to use Yii2 to replicate and load balance access to our databases.

Through this class, we can connect to a variety of different database types, ranging from local SQLite databases to clustered MySQL databases. The simplest way to establish a connection to a database is to create a SQLite database connection, as follows: We can keep our application DRY by putting our database coniguration into the db component of our web or console coniguration ile.

As an example, establishing a SQLite connection in this ile will be done as follows: Furthermore, since Yii2 loads components only when required, it can keep our application lean and performant. In Yii2, components are only loaded when required. This process is often called lazy loading.

Unless a component is preloaded, Yii2 will not create an instance of that component until it is irst used. After being initially instantiated, Yii will then reuse the same component across your application rather than creating multiple instances of that component.

Lazy loading is one of the primary reasons Yii is so performant. With our database coniguration stored within our coniguration ile, we can now access the database connection, as follows: As stated earlier, Yii2 can connect to several different database types. A few examples of the data source names DSNs that Yii2 supports are listed here: More information on these base drivers can be found within the PHP manual at https: More information on this driver can be found in the PHP manual at https: Note that Yii2 will not be able to connect to any database unless the appropriate PHP drivers are properly installed and conigured.

If you aren't certain which drivers you have installed, the native phpinfo function can output a list of all the currently installed PHP extensions. Within the db component, simply specify the username and password attributes that are appropriate for your database. Additional coniguration options In addition to the basic db component options listed previously, Yii2 also provides several additional options that can be used to either enhance the performance of your application or deal with a known issue within the native PHP drivers.

While many of these options can be found in the Yii guide and the API documentation, some of them will most likely be used more often than others. By default, Yii2 will try to use the native prepare support built into the native PDO driver. To improve the performance of our application, we can set this value to true and allow Yii to cache commonly executed queries.

In an application that mostly performs read actions, enabling this attribute can greatly increase the performance of your application.

You might also like: SPRING FRAMEWORK TUTORIAL PDF

To completely enable this component, however, the additional properties we'll mention now must be set as well. If unset, this will simply default to the cache component in our application. By default, the query cache will be valid for 3, seconds, or 60 minutes: Before Yii accesses the database, it will often need to determine the database schema. This schema information is used to assist Yii when running validators and working with relational models, such as related Active Record models.

Any change to the underlying data or schema in your database may cause your application to return bad data or crash entirely. Writing database migrations When building and maintaining modern web applications, the underlying structure of our database may need to change to account for changes in requirements or scopes.

To ensure that our database schema can evolve in tandem with our source code, Yii2 provides built-in support to manage database migrations. Using database migrations, we can treat our database as an extension of the source code and easily change it when our source code changes.

When paired properly, we can often write our migrations in a way that enables them to be run across a variety of database types. For example, when working locally, we might need to use a local SQLite database even if our application will ultimately run on a MySQL database. At the heart of this class is a variety of different schema types that Yii2 will be able to properly map to the appropriate data type within our database. For a complete list of the available constants made available by the Schema class, ensure that you refer to the Yii2 guide at http: Within our migrations, we can call any of these constants by running this: Using the source code from the previous chapter as a starting point, we'll do this by running the following from the command line: Depending upon the ile permissions on your system, Yii2 may not be able to create the migrations folder if it does not exist.

When running migrations, Yii2 will execute them in the order in which they were created. Because of this naming convention, any migration that you create will have a distinct and unique ilename. If you're following along, ensure that you're working in the ile that was created from the. These two operations correspond to one of four functions: The up and down methods are the base methods required to run migrations and will execute any database command issued inside them even if there is an error.

Alternatively, we can use the safeUp and safeDown methods, which are functionally identical to the up and down methods, with the exception that the entire operation is wrapped within a transaction. If our database supports transactions, running our migrations from the safe methods can help us catch migration errors at runtime before an error can cause problems with our entire database.

Because of the additional safety they offer, safeUp and safeDown should be our go-to methods when writing migrations. Additionally, if safeUp or safeDown are used, the unsafe methods cannot be used. We'll start by simply storing an ID, an email address, a password, the username, and some timestamp metadata indicating when our user was created and last updated.

Within our migration, we can write this as follows: We can either directly use the constants deined by the Schema class, or we can use the native migration methods, such as primaryKey , integer , string , and text. Using the migration methods is preferred because it permits us to add additional attributes to our column, such as the column size and length. For a complete list of methods offered by the migration class, refer to the Yii2 guide at http: In the previous example, we outlined two methods: While Yii2 is smart enough to work with any ield names you specify, following this convention will make your code more readable and working with your databases less complicated.

While you don't have to explicitly follow this convention, following a convention can save you a lot of time in the future. Running migrations Running our migrations can be done through the yii command, as shown in the previous chapter: Using the sqlite command-line tool, we can explore our SQLite database: By running the. The second table, user, shows the resulting schema that was created by Yii from our migration class.

While database migrations are suited for most database changes, running them against large datasets may result in your database being unavailable to your application, resulting in downtime. Make sure that before you run a database migration through Yii2, your application should be able to handle temporary downtime. If even temporary downtime is not appropriate for your application, you may need to consider migrating your data to an updated schema in other ways.

In this instance, we want to change our migrations without causing harm to their local instance; we can create new migrations that users of our code can apply in order to bring their applications up to date. We may also want to make a few changes to other ields, such as our email ield, to prevent them from being NULL.

We can do this by writing a new migration and altering the schema of the database itself. We'll start by creating a new migration: In the same vein, addColumn will add a new column with the speciied name and schema to our database, alterColumn will alter the schema for the named column, and createIndex will create a unique index on the email ield in our database, which will ensure that no two users will share the same email address.

If we try to run these migrations against our SQLite database, however, we would be presented with an error similar to the following, indicating that SQLite doesn't have support for these methods: Since we're using SQLite, however, we'd have to rewrite our initial migration command and notify users of our application about the change.

Consequently, if we need to query data within a migration, we will need to use Yii2's Query Builder to do this, which we'll cover later in this chapter. If our application has widespread adoption, it might be better to query for all of our users with Query Builder and store them temporarily in the memory or a temporary store if we have a large number of records. Then, after creating our new table schema for our users table, we could then reinsert them into our database using the insert method.

After updating our new migration, we can rerun our migration command. Take a look at the Yii2 documentation at http: Database access objects Yii database access objects, commonly referred to as DAO, provide a powerful object-oriented API to work with a relational database.

Consequently, it is signiicantly more performant to work with DAO statements than it is to work with either Active Record or Query Builder. Since our db component is already properly conigured for SQLite, we'll use it moving forward. With DAO, there are two general types of queries that we can run: Querying for data The irst way in which we can use DAO is to query for data.

There are four main methods that are used to query for data: Using our user table as an example, we can query for all the users in our database by running the following command: In the event that no data is found, this method will return false: For instance, if we want to count the number of users in our database, we can use queryScalar to get the value: The inal method, queryColumn , is used to query a speciic column in our database.

For instance, if we want to know the email addresses of all the users in our database, we can use queryAll to fetch all that data, or we can use queryColumn , which would be signiicantly more eficient to use as it would query for less data: With our knowledge of these methods, as an exercise, let's go back to our previous migrations and rewrite them to preserve our users across our schema change: First, let's roll back our migrations to properly simulate the scenario: Next, let's seed our database with some test data: If we take a look at our database, we'll see that the initial schema and data is now in place.

The new code blocks have been highlighted for easy viewing: Now we can rerun our migration. If successful, we should see our original migration run and an insert call executed for each user in our database.

Finally, we can query our SQLite database to preview the updated schema and see our updated users: Quoting table and column names When writing database-agnostic SQL queries, properly quoting ield names can be problematic. To avoid this problem, Yii2 provides the ability to automatically quote table and column names for you using the correct quoting rule for the speciic database in use.

To automatically quote a column name, simply enclose the column name in square brackets: To execute these commands, we can use the execute method in general: Yii2 also provides convenient wrappers for insert , update , and delete , which enables us to write commands without having to write raw SQL.

These methods properly escape and quote table and column names and bind parameters on your behalf. For instance, we can insert a new user into a database as follows: We can also delete a user in our database using the delete method: Parameter binding The number one rule when working with user-submitted data is to never trust user-submitted data. Any data that passes through our databases and has come from an end user needs to be validated, sanitized, and properly bound to our statements before they are executed against our database.

To help protect against SQL injection, Yii2 offers several different ways to bind parameters to our queries in a way that will ilter our injected SQL.

These three methods are bindValue , bindValues , and bindParam. The irst method, bindValue , is used to bind a single parameter to a token within our SQL statement. For example, we can rewrite the previous query as follows: Following the previous example, we can write the following to update multiple users without having to rewrite our query each time: This will protect you against future changes to your code.

Transactions When running multiple queries in a sequence, we often want to ensure that our database state remains consistent across these queries. Most modern databases support the use of transactions to accomplish this. In a transaction, changes are written to the database in such a way that they can be committed if everything went well or rolled back without consequence if any given query within the transaction failed.

In Yii2, this looks as follows: Yii's Query Builder allows us to write database-agnostic queries in a programmatic way. Consequently, queries written through the Query Builder are signiicantly more readable than their DAO counterparts. For example, we could simply query for all the users in our database in Query Builder using the following code: Query construction methods The basics of Query Builder involve the chaining of multiple query methods together.

These method names directly correspond with the SQL segment that they are named after. When working with Query Builder, the most common methods that you'll use will be the select , from , and where methods. For instance, the following queries are identical: If you choose to list the column names as a string, ensure that you do that consistently throughout your application. In the following examples, we'll use the array format. The select method also supports column aliases and table preixes, as shown in the next example: For instance, if we want to retrieve the user's complete name as a single ield, we can execute the following query: For instance, if we want to list all the irst names of our user's database, we can execute the following query: The from method Our previous examples have already illustrated the basic usage of the from method.

The from method can also be used to specify a table alias, as shown in the following example: The where method The where method speciies the where segment of our SQL query and can be used either in a string format, hash format, or operator format. The string format The string format of the where method should always be chained with the addParams method in order to prevent SQL injection: Rather than passing a string as a parameter, we can instead pass an array of key values representing the column name and value.

For example, we can ind all the users in our database with the irst name of John who were in their 20s and who didn't have a listed pet name by running the following query: We will have to adjust our schema with a migration to add these ields to our database.

This would result in the following query: The operator format The last way to use the where method is to use the operator format. In general, the operator format takes the following format: As you can imagine, the where method can quickly become very bulky and complicated.

Rather than using the operator, you may ind your code more readable by using the andWhere or orWhere methods to chain multiple conditions together: For example, to sort all of our users in our database by age, we can construct the following query: When properly used together, these two methods form the basics of paginating through results: Yii2 supports these methods via the groupBy and having methods.

After grouping our results with groupBy , we can then ilter our results with the having method, which behaves the same as the where method. The following example will only show the number of users in our dataset who are over a speciied age: Joins and unions can be performed through query builder using the join and union methods. The join method has the following method syntax: For example, suppose we had a posts and users table. We could join them as follows using the join method: The result would include all users joined with all the posts that they owned.

Pdf yii framework

Joins can also be performed by type using the shortcut methods rightJoin , leftJoin , and innerJoin. Yii2 provides the following query methods to execute queries built with Query Builder. Most of the times when working with Query Builder, we'll want to fetch all the records in our database. Carefully consider using the all method if you have a large dataset, as the resulting query execution could take a long time to complete, and it could either hang or cause an error in your application.

In other instances, it may be more beneicial just to fetch the irst row of a query. To fetch the irst row, we can use the one method: To achieve this, we can use the exists method, which will return either true or false, indicating that data would be returned from the resulting query. To fetch scalar values with query builder, we can use the scalar method. For instance, if we want to know how old the oldest user is in our database using the MAX SQL method, we can use the following code to return an integer representing their age: To fetch the irst row of our results, we can use the column method: Consequently, an array of all IDs in our database will be returned.

It's important to remember when querying for data that you only query for the data you need. If you need all data, you query for it in iterative way such as to limit the memory required for each query. To keep the memory consumption low and to prevent our application from hanging, we can use either the batch or each method.

By default, both methods will fetch rows from the database. To change the number of rows to be fetched, simply change the irst parameter of each method: Think of this method as a query appended with a limit and an offset parameter, which will restrict the number of returned rows.

Each iteration of the batch query will contain multiple results. Like the batch method, the each method can be used to reduce memory consumption as well, but it will iterate over the query row-by-row instead, which means that each iteration of the method will result in a single instance of our data. The beneit of using data providers and data widgets over queries built via Query Builder is that they provide an interface to automatically deal with sorting and pagination. Active data providers can also be populated through Query Builder, as shown in the following example: For more information on these data providers, check out the Yii2 guide at http: Once we have fetched our data with a data provider, we can pass the resulting data to a data widget.

Data widgets in Yii2 are reusable building blocks used within views to create complex interfaces to interact with data. In some instances, there may be sensitive data that we don't want to display on this page. Alternatively, there could simply be too much data to display in GridView. To restrict the number of ields to display in our GridView widget, we can use the columns attribute: More information on output data widgets can be found in the Yii2 guide at http: While some widgets, such as GridView, allow us to work with and display multiple rows, we can also use data providers and data widgets to display information for a single row.

With the DetailView widget, we can dynamically conigure a simple interface to display the information for a particular user in our database. The getModels method of our data provider splits our data provider into individual models that our DetailView widget can understand: This will be displayed on our screen: In addition to simply displaying results from a database, the DetailView widget also supports the custom formatting of certain rows.

More information on the formatter can be found at http: When working with large systems, we will split our database into a read-and-write master and a read-only slave of a set of slaves. Typically, our applications are unaware of our database architecture, which can introduce problems when required to migrate from a new master. With Yii2, we can conigure our database connection to not only be aware of our master-slave database coniguration, but also intelligently handle slave unavailability.

In Yii2, we can conigure a single master and multiple slaves using the following database coniguration. This will result in all writes going to our declared master and all reads going to one of our declared slaves: When working with slaves, Yii will attempt to connect to slaves in the list until a slave responds and load balance queries against each of the available slaves. By setting PDO:: Alternatively, using the following coniguration, we can conigure our application to work with both multiple masters and multiple slaves.

When using multiple masters, Yii will execute writes against any available master and will load balance writes between the available masters: When working with a master-slave topology, we may want to issue a read query against one of our masters. To do that, we would need to explicitly tell Yii2 to run our query against our master rather than our slaves: If we need to issue a transaction against a slave, we will need to explicitly begin the transaction on a slave, as follows: By working with database access objects, we showed how we can execute raw SQL statements to run against our database and how we can use transactions to protect our database integrity.

We also illustrated the use of Query Builder, which can enable us to write database-agnostic queries in a programmatic way. We then discovered how we can use Query Builder to construct intelligent data providers, which are used to supply data to reusable data widgets. Finally, we learned how to conigure Yii2 to be aware of master-slave and multi-master database cluster conigurations and how to load balance between these connections.

In the next chapter, we discover the capstone of working with databases in Yii2—Active Record—which is a powerful tool used to work with our data and model our database structure. We'll also dive into Active Records relatives, basic models, and forms, and we'll learn how we can use a powerful tool called Gii to automate the construction of much of the code our modern applications will work with.

These classes enable us to abstract our data management code away from DAO and Query Builder and into an easy-to-use programmatic interface. In this chapter, we'll cover the use and implementation of Active Record and learn how to create data models and custom forms.

We'll also cover how to conigure a powerful code generation tool called Gii to automate the creation of Active Record models and forms. Coniguring Gii While Active Record models and forms can be generated by hand, in most cases, we'll want to automate the creation of this code. To achieve this, Yii2 provides a code generation tool called Gii, which can be executed both from the command line and from a web interface in order to create Active Record models that work with our database structure and forms that work with both our base models and Active Record models.

In Yii2, nearly every module is available as a separate Composer package, which can be installed from the command-line interface. Consequently, we must use Composer to include Gii in our application. Since Gii is available as a composer package, we can include it in our application by running the following command from our command line: Typically, during our deployment process, we'll use the --no-dev lag to ensure that development packages are not deployed to our production environment.

With Gii installed, we now need to conigure it to work with both the Yii2 console and within our web browser. While this basic coniguration will properly load the Gii module, it doesn't follow our convention of being aware of our environment. For instance, if we went to production with this coniguration and deployed it with composer install --no- dev, as described earlier, our application would crash because Composer would not have installed the Gii module in our vendor folder.

Define in. Gii for console applications Unlike Yii1, Gii for Yii2 provides a new interface to work with Gii on the command line. With Yii2, we can now generate the source code for Active Record models, forms, and even extensions all from our command-line interface.

As we move through the rest of the chapter, we'll cover how to use Gii from the web interface as well as the console interface. Active Record One of the most important tasks when building rich web applications is ensuring that we properly model and represent our data in code. From a simple blog site to an application as big as Twitter, data modeling and representation are vital to ensuring that our application is easy to work with and can grow as required. The Active Record pattern Named by Martin Fowler in his book Patterns of Enterprise Application Architecture, the Active Record pattern is an object-relational mapping ORM pattern that's used to represent database rows and columns within an object.

In the Active Record pattern, each database column is represented by a single Active Record class.

Framework pdf yii

Upon instantiation, that object then provides a simple interface to manage individual rows or a collection of rows within our code. New rows can be created, old ones can be deleted, and existing rows can be updated—all within a simple and consistent API. Active Record also enables us to programmatically reference and interact with related data, which is usually represented in our database by foreign key relations.

In this section, we'll cover how to create new Active Record classes, how to implement them within our code, and some common pitfalls of working with Active Record. Before we start working with Active Record, we irst need to create a couple of tables that we can work with.

Included with the project resources for this chapter is a base migration that will create several new tables and populate them with some sample data: In Yii2, app is a predeined alias that points to our application base path.

If we want to, we can declare additional aliases, such as frontend and backend, to divide our application into different sections, which would enable us to create multiple Active Record instances in different namespaces. Finally, we need to implement the static method tableName within our class, which deines the table name our Active Record model will use. Since our Active Record model will use the user table, we will deine this method as follows: Using Gii to create our Active Record classes has several advantages: From this page, we can generate Active Record classes based upon our database schema.

Description updated. Borales at Jan 17, , 8: Thanks Thanks for this cool extension!

Framework pdf yii

Minor adjust to use with PHP versions prior to 5. Great - works also with Yii 1. Maybe someone would be interested on a display-or-generate snippet: Landscape Orientation I've tried setting orientation to 'L', but the generated pdf file still remains portrait.

Code example produces landscape MrLe at Mar 28, , 1: Landscape Orientation MrLe , try to do like this: Borales at Mar 28, , 5: Landscape Orientation borales, thanks for your reply. MrLe at Mar 28, , Hi Thanks for your extension. Small change for me zitter , thanks. I will fix this asap. Borales at May 18, , Great One How could I give a page break?

ShiblY KhaN at May 29, , 7: Page breaks shibly27 Try http: Wiseon3 at May 29, , 8: You must set parameters first i have edit my EYiiPdf. Invalid argument supplied for foreach I have some report to export to pdf.

If i use Html2PDF how to include the css in it.. Andra at Jul 6, , 2: To the Point.. Just exactly what I need for.. Thank you! Steven Ly at Jul 26, , Accelm at Jan 22, , 3: Thanks for this awesome extension! Thanks, Jonathan. Re staticblue , can you show your code with CSS part here? Borales at Apr 23, , 7: Re staticblue , are you sure your CSS rules are applied correctly in the given scope?

Borales at Apr 29, , 1: Hi Hi Borales, Thanks for your answer. What do you mean by "applied correctly in the given scope"? Model is not se anyboody try to mix the 2 extensions? Trejder at May 28, , 7: Please Help. Quark at Jun 17, , 8: Built in browser pdf viewers I was having similar problems viewing pdfs created by this software at first, but I think it was because I was trying to open it in my browser using its pdf viewer.

Accelm at Jun 17, , 1: Is this in my extension? I couldn't find it You can submit an issue tracker here https: Borales at Jul 19, , 9: Hi, Nice and easy to install. Thanks a lot Brother for this extension. EYiiPdf' , which can be the error? But in mpdf it is automatically adjust and will be a perfect PDF. Just download Old version of html2pdf , New version will have problem like dependencies are not installed.

Just like you have them now.

(PDF) Mastering Yii Framework lesforgesdessalles.info | Henrique Andrade - lesforgesdessalles.info

I hope it will work for you. I have used the same and working perfectly. This code works, just try to check you haven't made any mistake and secondly add this below code at the top of your html view file. It will add the button on the page which u want to make PDF, when u click on the button, it will download the file while it will take few seconds to a minute depending on page size.

Is ur View file showing results or not? If it is showing properly,then ur view file lorryprint should be like this. By clicking "Post Your Answer", you agree to our terms of service , privacy policy and cookie policy.

The results are in! See what nearly 90, developers picked as their most loved, dreaded, and desired coding languages and more in the Developer Survey. But the error is same. Suggest me solution of this or give any new idea.