<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2654119285807965593</id><updated>2024-10-24T07:29:28.719-07:00</updated><category term="codeigniter"/><category term="php"/><category term="crud"/><category term="css drop down"/><category term="download"/><category term="dynamic menu"/><category term="extending"/><category term="firephp"/><category term="grocery crud"/><category term="library"/><category term="outside"/><category term="pdf"/><category term="php codeigniter pdf mpdf"/><category term="table"/><category term="wordpress"/><title type='text'>PHP &amp;amp; Codeigniter stuff</title><subtitle type='html'>Here find my php codes specially codeigniter related.&#xa;Thanks.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://myphpcodes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://myphpcodes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tanwar</name><uri>http://www.blogger.com/profile/08043316030395843167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2654119285807965593.post-8389153615747797537</id><published>2012-03-29T10:43:00.002-07:00</published><updated>2012-03-29T10:43:42.107-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="codeigniter"/><category scheme="http://www.blogger.com/atom/ns#" term="outside"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="wordpress"/><title type='text'>Using Wordpress functions outside wordpress.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I am a fan of Codeigniter but I also love Wordpress, recently I read a topic on using wordpress function outside the wordpress i.e. the contents display function which are mostly used within themes can be used in other codeigniter project or even plain php files.&lt;br /&gt;
It is quite easy, Here goes the code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre style=&quot;background: none repeat scroll 0% 0% rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;?php  
 require( &#39;./wp/wp-load.php&#39; );  
 ?&amp;gt;  
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;
   &amp;lt;? echo wp_title(&#39;dd&#39;); ?&amp;gt;
&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;  
&amp;lt;body&amp;gt;  
&amp;lt;h1&amp;gt;&amp;lt;?php echo wp_title(&#39;dd&#39;);?&amp;gt;&amp;lt;/h1&amp;gt;  
&amp;lt;/body&amp;gt;&amp;nbsp; &lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
You may also use functions like:&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBxoncFNIGocw-rpgAbYE8pKD-tLYfXSGiSNcrQTMQVhzlYPWt8biG61JNDHQDJc0IM_7iC3iyO_GbKYZXmmBtk2oPIwZGLYv89JfUiJUlBTMaBvBl-0VXhxPxdQh8-nZT9E5RDfwJ3YeY/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; wp_nav_menu( array( &#39;container_class&#39; =&amp;gt; &#39;menu-header&#39;, &#39;theme_location&#39; =&amp;gt; &#39;primary&#39; ) );  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
to display add a dropdown menu (some css will be required for correct display of menu).&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://myphpcodes.blogspot.com/feeds/8389153615747797537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://myphpcodes.blogspot.com/2012/03/using-wordpress-functions-outside.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/8389153615747797537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/8389153615747797537'/><link rel='alternate' type='text/html' href='http://myphpcodes.blogspot.com/2012/03/using-wordpress-functions-outside.html' title='Using Wordpress functions outside wordpress.'/><author><name>Tanwar</name><uri>http://www.blogger.com/profile/08043316030395843167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2654119285807965593.post-4785696690775329730</id><published>2011-11-23T18:35:00.000-08:00</published><updated>2011-11-23T19:33:26.270-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php codeigniter pdf mpdf"/><title type='text'>Creating PDF files with Codeigniter</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Generating PDF files is required for saving and printing the documents like invoices or something.&lt;br /&gt;
&lt;br /&gt;
The task is easy with free pdf generation libraries like &lt;a href=&quot;http://code.google.com/p/dompdf/&quot; target=&quot;_blank&quot;&gt;dompdf&lt;/a&gt;, &lt;a href=&quot;http://www.mpdf1.com/mpdf/&quot; target=&quot;_blank&quot;&gt;mpdf&lt;/a&gt;, &lt;a href=&quot;http://www.fpdf.org/&quot; target=&quot;_blank&quot;&gt;fpdf &lt;/a&gt;etc.&lt;br /&gt;
Below is the code for generating pdf from html using mpdf library.&lt;br /&gt;
First extract mpdf files in codeigniter /library/mpdf53.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
private function _gen_pdf($html,$paper=&#39;A4&#39;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;load-&amp;gt;library(&#39;mpdf53/mpdf&#39;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $mpdf=new mPDF(&#39;utf-8&#39;,$paper);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $mpdf-&amp;gt;WriteHTML($html);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $mpdf-&amp;gt;Output();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
To use the code below to simply redirect the output to the function as:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
public function doprint($pdf=false)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;load-&amp;gt;library(&#39;parser&#39;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $data = $this-&amp;gt;data-&amp;gt;getdata();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $output = $this-&amp;gt;parser-&amp;gt;parse(&#39;form&#39;,$data,true);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($pdf==&#39;print&#39;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;_gen_pdf($output);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;output-&amp;gt;set_output($output);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will generate the pdf file within the browser.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://myphpcodes.blogspot.com/feeds/4785696690775329730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://myphpcodes.blogspot.com/2011/11/creating-pdf-files-with-codeigniter.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/4785696690775329730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/4785696690775329730'/><link rel='alternate' type='text/html' href='http://myphpcodes.blogspot.com/2011/11/creating-pdf-files-with-codeigniter.html' title='Creating PDF files with Codeigniter'/><author><name>Tanwar</name><uri>http://www.blogger.com/profile/08043316030395843167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2654119285807965593.post-2399151443654654032</id><published>2011-10-05T00:37:00.000-07:00</published><updated>2012-03-03T18:18:21.546-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="codeigniter"/><category scheme="http://www.blogger.com/atom/ns#" term="crud"/><category scheme="http://www.blogger.com/atom/ns#" term="css drop down"/><category scheme="http://www.blogger.com/atom/ns#" term="download"/><category scheme="http://www.blogger.com/atom/ns#" term="dynamic menu"/><category scheme="http://www.blogger.com/atom/ns#" term="firephp"/><category scheme="http://www.blogger.com/atom/ns#" term="grocery crud"/><category scheme="http://www.blogger.com/atom/ns#" term="pdf"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><title type='text'>Recommended libraries with Codeigniter.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi,&lt;br /&gt;
Here are few libraries which I use and recommend with &lt;a href=&quot;http://www.codeigniter.com/&quot;&gt;Codeigniter.&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://github.com/benedmunds/CodeIgniter-Ion-Auth&quot;&gt;Ion Authentication Library &lt;/a&gt; Very comfortable to use Authentication Library.&lt;br /&gt;
&lt;a href=&quot;http://www.grocerycrud.com/&quot;&gt;Grocery CRUD&lt;/a&gt; Good CRUD with great features.&lt;br /&gt;
&lt;a href=&quot;http://codeigniter.com/forums/viewthread/154719/&quot;&gt;Dynamic Menu&lt;/a&gt; Generated drop-down or other navigation menu through database.&lt;br /&gt;
(though I have done some modification in the library to be used with &lt;a href=&quot;http://www.lwis.net/free-css-drop-down-menu/&quot;&gt;Free CSS Drop-Down Menu&lt;/a&gt; which I will be posting later.&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/firephp/&quot;&gt;Firephp &lt;/a&gt;for debugging, logging etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://myphpcodes.blogspot.com/feeds/2399151443654654032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://myphpcodes.blogspot.com/2011/10/recommended-libraries-with-codeigniter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/2399151443654654032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/2399151443654654032'/><link rel='alternate' type='text/html' href='http://myphpcodes.blogspot.com/2011/10/recommended-libraries-with-codeigniter.html' title='Recommended libraries with Codeigniter.'/><author><name>Tanwar</name><uri>http://www.blogger.com/profile/08043316030395843167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2654119285807965593.post-5037672809925273468</id><published>2011-09-16T20:21:00.000-07:00</published><updated>2012-03-03T18:18:50.259-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="codeigniter"/><category scheme="http://www.blogger.com/atom/ns#" term="extending"/><category scheme="http://www.blogger.com/atom/ns#" term="library"/><category scheme="http://www.blogger.com/atom/ns#" term="table"/><title type='text'>Extending Table Library in Codeigniter</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Codeigniter has a great Table library to display data in html table format. Adding a Serial No is sometime required to a table, but Row num is not easily provided by MySQL hence while using Table library this function is added to do the job.&lt;br /&gt;
&lt;br /&gt;
Here goes the code:&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBxoncFNIGocw-rpgAbYE8pKD-tLYfXSGiSNcrQTMQVhzlYPWt8biG61JNDHQDJc0IM_7iC3iyO_GbKYZXmmBtk2oPIwZGLYv89JfUiJUlBTMaBvBl-0VXhxPxdQh8-nZT9E5RDfwJ3YeY/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; /**  
    * Set the serial no  
    *  
    * Add serial no to left of table  
    *  
    * @access  public  
    * @param  mixed  
    * @return  mixed  
    */  
   function add_sr_no(&amp;amp;$arr)  
   {  if (!is_array($arr)) return $arr;  
     $i=1;  
     foreach ($arr as &amp;amp;$values) {        
       if (!is_array($values))  
         break;  
       else  
         array_unshift($values, $i++);  
     }      
     return $arr;  
   }  
&lt;/code&gt;&lt;/pre&gt;
Just add these lines to table.php in library.&lt;br /&gt;
Usage:&lt;br /&gt;
$rows = $query-&amp;gt;result_array(); &lt;br /&gt;
$this-&amp;gt;table-&amp;gt;add_sr_no($rows); &lt;br /&gt;
Don&#39;t forget to add first column &#39;Sr No&#39; in set_heading.&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Views are invited.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://myphpcodes.blogspot.com/feeds/5037672809925273468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://myphpcodes.blogspot.com/2011/09/extending-table-library-in-codeigniter.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/5037672809925273468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2654119285807965593/posts/default/5037672809925273468'/><link rel='alternate' type='text/html' href='http://myphpcodes.blogspot.com/2011/09/extending-table-library-in-codeigniter.html' title='Extending Table Library in Codeigniter'/><author><name>Tanwar</name><uri>http://www.blogger.com/profile/08043316030395843167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>