<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://ionizecms.com/forum/extern.php?action=feed&amp;tid=787&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[ionize CMS forum / Migrate controllers, models and views from codeigniter to ionize cms]]></title>
		<link>http://www.ionizecms.com/forum/viewtopic.php?id=787</link>
		<description><![CDATA[The most recent posts in Migrate controllers, models and views from codeigniter to ionize cms.]]></description>
		<lastBuildDate>Wed, 25 Apr 2012 15:39:06 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3744#p3744</link>
			<description><![CDATA[<p>I also got a new idea while thinking over this: you serialize your object or array and return that value, and then unserialize it on your view. It&#039;s not a very nice approach and I&#039;m not sure if it&#039;ll work, but it just might.</p>]]></description>
			<author><![CDATA[dummy@example.com (kojiroh)]]></author>
			<pubDate>Wed, 25 Apr 2012 15:39:06 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3744#p3744</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3743#p3743</link>
			<description><![CDATA[<p>Quick way to get data from array to tag : </p><div class="codebox"><pre><code>/**
     * @usage    &lt;ion:users&gt;
     *              &lt;ion:user field=&quot;your_field_name&quot; /&gt;
     *         &lt;/ion:users&gt;
     */
    public static function user(FTL_Binding $tag) {
        $field = (isset($tag-&gt;attr[&#039;field&#039;]) ) ? $tag-&gt;attr[&#039;field&#039;] : FALSE;

        if ($field) {
            if (!empty($tag-&gt;locals-&gt;user[$field]))
                return self::wrap($tag, $tag-&gt;locals-&gt;user[$field]);
        }

        return &#039;&#039;;
}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Wed, 25 Apr 2012 11:50:34 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3743#p3743</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3742#p3742</link>
			<description><![CDATA[<p>It is possible that Ionize needs arrays to work with tags so you might want to convert your DB objects to arrays via row_array or result_array.</p><p>Edit: Disregard the above, I totally missed the point.</p><p>You can&#039;t directly pass an object or an array to the view using tags. What you have to do is define more nested tags. For example, if you have an array called &quot;car&quot; with two keys, &quot;color&quot; and &quot;year&quot;, you would have to create 3 tags: car, car_color and car_year. The first one should set a local variable for your car and expand the tag; while the other ones should return the corresponding keys of the local car variable. I can&#039;t write a code example right now but I hope this much can help you.</p>]]></description>
			<author><![CDATA[dummy@example.com (kojiroh)]]></author>
			<pubDate>Tue, 24 Apr 2012 21:09:21 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3742#p3742</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3741#p3741</link>
			<description><![CDATA[<p>Thanks for the tips! After configuring the &quot;Simpleform&quot; module, I&#039;ve managed create the form that I wanted and write the required data to the database.</p><p>My problem now is that I don&#039;t know how to pass an object (or an array) to the tag. </p><p>I.e.</p><p>1. Inside my users tag I define an object called $output which consists of two arrays.</p><div class="codebox"><pre><code>public  function users(FTL_Binding $tag)
{    
....
$output = $ci-&gt;my_crud-&gt;render();
$tag-&gt;locals-&gt;output_tag = $output;
$tag-&gt;expand();
}</code></pre></div><p>2.I define the output_tag which should return the $output object</p><div class="codebox"><pre><code>public static function output_tag(FTL_Binding $tag) {
      
        return isset($tag-&gt;locals-&gt;output_tag) ? $tag-&gt;locals-&gt;output_tag : &#039;&#039;;
}</code></pre></div><p>3. I call the output_tag inside my view :</p><div class="codebox"><pre><code>&lt;ion:users&gt;
    &lt;ion:output_tag/&gt;
&lt;/ion:users&gt;</code></pre></div><p>I get the following error : <br />A PHP Error was encountered<br />Severity: 4096<br />Message: Object of class stdClass could not be converted to string<br />Filename: ftl/parser.php<br />Line Number: 159</p><p>Can you help me pass the object in the view via tag ?</p>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Tue, 24 Apr 2012 20:26:32 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3741#p3741</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3697#p3697</link>
			<description><![CDATA[<p>Check the simpleform module for form validation an other things will help you</p>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Fri, 13 Apr 2012 22:28:50 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3697#p3697</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3696#p3696</link>
			<description><![CDATA[<p>Thanks a lot kojiroh and ukyo! That worked for me! I also realized that is much better to move the code from the controller to the tags library. Is that approach correct?</p><p>Furthermore, I would like to ask if I can call the helper functions inside the tags i.e.:</p><div class="codebox"><pre><code>$ci =  &amp;get_instance();
$ci-&gt;load-&gt;helper(&#039;form&#039;);
$ci-&gt;load-&gt;library(&#039;form_validation&#039;);</code></pre></div><p>And after the above, to actually perform the validations:</p><div class="codebox"><pre><code>$ci-&gt;form_validation-&gt;set_rules(&#039;album_name&#039;, &#039;Album Name&#039;, &#039;required&#039;);
$ci-&gt;form_validation-&gt;set_rules(&#039;description&#039;, &#039;Album Description&#039;, &#039;required&#039;);
$ci-&gt;form_validation-&gt;set_rules(&#039;privacy&#039;, &#039;privacy&#039;, &#039;required&#039;);
$ci-&gt;form_validation-&gt;set_rules(&#039;private_code&#039;, &#039;Private Code&#039;, &#039;required&#039;);</code></pre></div><p>Is it possible and and good in terms of design ?</p>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Fri, 13 Apr 2012 19:37:09 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3696#p3696</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3689#p3689</link>
			<description><![CDATA[<p>Its possible to use also directly pass a variable. but its making ionize slow.</p>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Fri, 13 Apr 2012 08:41:53 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3689#p3689</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3687#p3687</link>
			<description><![CDATA[<p>In Ionize, you don&#039;t directly pass a variable to the view. Instead, you use the &lt;ion:... /&gt; tags. Since you&#039;ve already created your tags library, here&#039;s what you should do:</p><p>1. Assuming you&#039;ve already created your $private_code, add that to your $tag variable locals in your index function before expanding the tag:</p><div class="codebox"><pre><code>...
$tag-&gt;locals-&gt;private_code = $private_code;
$tag_expand();
...</code></pre></div><p>2. Create a function to return your private code to your view:</p><div class="codebox"><pre><code>public static function private_code(FTL_Binding $tag) {
   return isset($tag-&gt;locals-&gt;private_code) ? $tag-&gt;locals-&gt;private_code : &#039;&#039;;
}</code></pre></div><p>3. Include the tag in your view:</p><div class="codebox"><pre><code>&lt;ion:photo_album&gt;
     &lt;p&gt;My private code is &lt;ion:private_code /&gt;!&lt;/p&gt;
     &lt;ion:title /&gt;
&lt;/ion:photo_album&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (kojiroh)]]></author>
			<pubDate>Fri, 13 Apr 2012 08:25:25 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3687#p3687</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3678#p3678</link>
			<description><![CDATA[<p>Thanks again for the guidance ukyo. I&#039;ve managed to create the tag functions on tags.php file of my module (I renamed it to Photoalbums). I followed the example of &quot;Fancyupload&quot; module.</p><p>Inside tags.php :</p><div class="codebox"><pre><code> public static function index(FTL_Binding $tag)
    {
        // Get the module URI
        include APPPATH . &#039;config/modules.php&#039;;

        $uri = array_search(&#039;Photoalbums&#039;, $modules);
        
        $tag-&gt;expand();
            
        return $tag-&gt;parse_as_nested(file_get_contents(MODPATH.&#039;Photoalbums/views/photoalbums/create&#039;.EXT));
    } </code></pre></div><p>The problem is that i want to pass a variable from the controller to the&quot;create&quot; view (i.e. $private_code_element). How can I do it ?</p><p>On plain CodeIgniter I was using it as follows:<br />controller</p><div class="codebox"><pre><code> $data_to_view[&#039;private_code_element&#039;] = $private_code;  
$this-&gt;load-&gt;view(&#039;photoalbums/create&#039;,$data_to_view); </code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Wed, 11 Apr 2012 22:05:52 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3678#p3678</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3657#p3657</link>
			<description><![CDATA[<p>You need to write also tags for your module. And you can create a page &quot;Photo Album&quot; and special view for &quot;Photo Album&quot; page you can use tags inside your view file like : </p><div class="codebox"><pre><code>&lt;ion:photo_album&gt;
     &lt;ion:title /&gt;
&lt;/ion:photo_album&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Mon, 09 Apr 2012 12:36:04 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3657#p3657</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3655#p3655</link>
			<description><![CDATA[<p>Thanks again ukyo! I see the importance of defining the custom db tables.</p><p>What I still haven&#039;t found is how to link the modules, that I&#039;ve created, to a page inside my theme. I.e.I have created a Module (Name: &quot;Photo_albums Module&quot;, URI: &quot;photo_albums&quot;) and would like to display the content inside my ionize theme&#039;s page. Is that possible ?</p>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Sun, 08 Apr 2012 21:09:17 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3655#p3655</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3654#p3654</link>
			<description><![CDATA[<p>If you define all your custom db tables to &quot;config.xml&quot; next module installation will be easy for you</p>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Sun, 08 Apr 2012 16:12:23 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3654#p3654</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3651#p3651</link>
			<description><![CDATA[<p>Thanks for your prompt reply ukyo !</p><p>I&#039;ve managed to create new modules following the Demo module and the &quot;<a href="http://ionizecms.com/en/news/ionize-creating-a-module">http://ionizecms.com/en/news/ionize-creating-a-module</a>&quot; howto guide.</p><p>Another question: Do I need to define all my custom db tables to the &quot;config.xml&quot; of the newly created module? </p><p>The next step is to load the custom modules to my existing theme.</p>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Sun, 08 Apr 2012 11:08:00 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3651#p3651</guid>
		</item>
		<item>
			<title><![CDATA[Re: Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3650#p3650</link>
			<description><![CDATA[<p>Check the demo modules</p>]]></description>
			<author><![CDATA[dummy@example.com (ukyo)]]></author>
			<pubDate>Sat, 07 Apr 2012 09:59:41 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3650#p3650</guid>
		</item>
		<item>
			<title><![CDATA[Migrate controllers, models and views from codeigniter to ionize cms]]></title>
			<link>http://www.ionizecms.com/forum/viewtopic.php?pid=3644#p3644</link>
			<description><![CDATA[<p>Dear all,</p><p>I&#039;m new to codeigniter and so far find it extremely usefull for creating web apps. I have created several controllers, models and views in codeigniter but came at a point where a cms was needed in order to create a three level administration menu.</p><p>Ionize CMS is perfect for what I need but I have a basic (rookie) question : How do I migate the controllers, the models and the views that I created on Codeigniter to Ionize installation ? Is a simple copy paste from CI to Ionize enough ?</p>]]></description>
			<author><![CDATA[dummy@example.com (nrafto)]]></author>
			<pubDate>Fri, 06 Apr 2012 14:14:37 +0000</pubDate>
			<guid>http://www.ionizecms.com/forum/viewtopic.php?pid=3644#p3644</guid>
		</item>
	</channel>
</rss>
