Default template engine in codeiginter? - codeigniter

Can anyone tell me which template engine codeiginter used by default.line other framework like laravel.

Template Parser Class
CodeIgniter does not require you to use this class since using pure PHP in your view pages lets them run a little faster.
I would suggest if you really want to use a template engine to have a look at these links:
If you're looking for a simple and easy way to implement Twig Template Engine in your project (by CodeIgniter version):
CI 2.x:
http://edmundask.github.io/codeigniter-twiggy/
https://github.com/dilantha/codeigniter-twig/
CI 3.x:
https://github.com/kenjis/codeigniter-ss-twig

Related

generate html template engine i18n

I am searching for a solution to modularize static html files and to add multilanguage support. I want to generate static html files with gulp which are then served through an apache server.
I am now thinking about using the template engine marko to modularize html files and to prerender html files (handlebars would also be an option; jade is no option cause i don't like the syntax).
For multilanguage support i am thinking about to add an i18n plugin (for example https://www.npmjs.com/package/i18n). But this plugin needs an express server; also for multilanguage i want to prerender the files. Has anybody a hint for me which i18n plugin would best fit for me? Maybe also which one would best work together with marko and gulp?
The result should be html files generated inside /de and /en.
The following sample app might help: https://github.com/marko-js-samples/marko-koa-i18n
It is a server-based app that uses Koa and koa-i18n, but you can directly use i18n-2 to accomplish the same thing.
Disclaimer: I have not used i18n-2 or koa-i18n
A few things to note:
A custom tag is used to introduce a local variable that can be used to access the i18n bundle: (see: src/components/app-hello/template.marko and src/taglib/i18n-var-tag.js)
The i18n bundle is pulled out of out.global.i18n. See: Marko > Global Properties
The following Gulp plugin is currently out-of-date, but it might serve as a good starting point or you can submit a PR to improve it: https://github.com/viviangledhill/gulp-marko
In your case, you will want to prerender each template multiple times, each time with a different i18n bundle instance passed in as a global property.
If you would like more details please ask here or in the Gitter chat room: https://gitter.im/marko-js/marko
Hope that helps.

Using Code Igniter active record in Wordpress

Need to move some code from Code Igniter to Wordpress. It is heavily using CodeIgniter's db classes to handle the database. I would like to use them like this, instead of translating to WP's wpdb.
Is there any way of using Code Igniter active record/db classes and keep the nice CI db usage in Wordpress?
Thanks
If you are using WordPress 3.3 and above, then you can make use of the following library WordPressIgniter
Usually, it's not as straight forward as you think, because both of them have their own code structure. But many have tried it and are successful. It depends on what features you want to use and to what depth.
Following links may come handy for you:
SO - CI WodrePress Integration
http://www.marketingadept.com/blog/integrating-codeigniter-and-wordpress/

View creation in codeigniter

I am using Codeigniter to developing an application. My doubt is in the view i am using normal html tags. Is it a good method or should I use codeigniter's native tags for creating html tags?
the best way is:
you should use the codeigniter native tags, because, it achieves the better security mechanaism the ci framework have. (security features such as xss_clean are worked with the ci tags)...

Getting started with Phil Sturgeon's CodeIgniter Template library

I'm trying to use Phil Sturgeon's CodeIgniter Template library, but I can't get it to change my pages. I read the documentation, followed the steps there,
Download
Copy to application folder
Create a views/layouts/default view
(Auto)load the library
however, it is not clear as to how the template is actually implemented. I thought that loading the view would apply the template everywhere, but it doesn't seem to work that way. I've also read about it in the CodeIgniter Wiki, but it looked too complicated to be the right answer.
How are you supposed to use Phil Sturgeon's Template with your controllers? (or views?) Am I missing something here?
It does not overload the load->view() methods, that would be bad. You need to update your controllers to use the template's syntax and methods in every instance you want to use it:
http://philsturgeon.co.uk/demos/codeigniter-template/user_guide/
You will use $this->template->build() instead of $this->load->view() in most cases, after constructing your template by defining regions, setting titles, etc.
There should have been a user guide included in your download with examples.

Codeigniter: How can I use codeigniter's default view system along with smarty templates

I don't want to remove smarty templates from controllers. In some actions of controllers, I want to use default view system of codeigniter, while on other actions, I want to keep SMARTY templates as display medium. How can I achieve this?
Thanks in advance
I've been developing a CI Smarty library for Codeigniter. It lets you use default Codeigniter views and lets you render Smarty templates using the Codeigniter template parser as I am extending it.
Here is the repository: https://github.com/Vheissu/Ci-Smarty
As it stands, it works really well. If you have any problems, log an issue on Github and I'll fix it usually within 24 hours. Other solutions are mostly outdated, my library lets you use new Smarty 3 features like template inheritance, etc.
Look in the CodeIgniter Wiki - http://codeigniter.com/wiki/Smarty/
And a thread in the official forum:
http://ellislab.com/forums/viewthread/60050/

Resources