#1 2012-08-29 10:05:21

minhhung-tran
Member
Registered: 2012-08-23
Posts: 6

ionize ver 0.97 can not use ion tag from module

Hi all, i trying write a module for ionize call Hello. I put my module in /modules/ folder.
FIRST:
When I put
    hello_view.php in
the module: module/hello/views/hello_view.php,

some ion tag doesn't work. But when i move the view to
  themes/demo/views/hello_view.php , it 's work fine.

SECOND:
I want to add a function googlemap to class Hello_Tags to do some think like return a google maps, or a string, how to I do it.
Calling google map in view by this code:

<ion:googlmap/>

If 1st is not a bug, please leave confirm and reply solution for 2nd to my topic
Thank you, core team wink

This is my Controller

class Hello extends Base_Controller 
{

	// ------------------------------------------------------------------------


	/**
	 * Constructor
	 *
	 */
	public function __construct()
	{
		parent::__construct();
                Hello_Tags::init();
	}
	// ------------------------------------------------------------------------
     //this function is for out put some thing
    function hellohung()
    {
        $this->load->model('article_model');  
        $articles = $this->article_model->get_list();
        
        //print_r($articles); 
        // Template view
        Theme::output('hello_view', array(
                'charset'=>'utf-8',
                'language'=>'en' ,
                'articles'=>$articles
            )
        );
    }

And this is my Hello_Tags:

class Hello_Tags extends TagManager
{
	
	/**
	 * Base search module tag
	 * The index function of this class refers to the <ion:search /> tag
	 * In other words, this function makes the <ion:search /> tag available as main module parent tag
	 * for all other tags defined in this class.
	 *
	 * @usage	<ion:hello >
	 *			...
	 *			</ion:hello>
	 *
    */

    public static $tag_definitions = array
    (
        'hello' => 'tag_hello',
        'hello:index' => 'tag_hello_index',
        'hello:count' => 'tag_hello_count',
        'hello:field' => 'tag_hello_field',
        'hello:fields' => 'tag_hello_fields',
        'hello:fields:attribute' => 'tag_hello_fields_attribute'    
    );
	public static function index(FTL_Binding $tag)
	{
        
		$str = $tag->expand();
		$str.="Im here now";
		return $str;
	}
    
    
    public static function tag_hello_count(FTL_Binding $tag)
    {
        return "100";
    }
    

// ------------------------------------------------------------------------

	public static function name(FTL_Binding $tag)
	{
		return MODPATH;

	}
}

This is my view

<h2>HELLO TAG</h2>
    <ion:hello>
        <ion:count/>  
        <ion:test_abc/>     
    </ion:hello>
    <ion:googlemaps/>  
<hr>

Last edited by minhhung-tran (2012-08-29 11:16:59)

Offline

#2 2012-08-30 09:41:49

minhhung-tran
Member
Registered: 2012-08-23
Posts: 6

Re: ionize ver 0.97 can not use ion tag from module

Hi all, I have solution for SECOND. This is my code
tags.php

class Hello_Tags extends TagManager 
{

	public static function index(FTL_Binding $tag)
	{
        
		return $tag->expand();
	}

	public function hello_field(FTL_Binding $tag)
    	{
        		$ci =& get_instance();
        
        		$str = $ci ->load->view('hello_fileld', array(
            	'str_1'=>'this is str_1',
            	'str_2'=>'this is str_2' 
        		),true); 
        
        		return $str;
    	}
}

hello_fileld.php

<p>str_1:<b><?= $str_1 ?></b></p>
<p>str_2:<b><?= $str_2 ?></b></p>

and usage:

<ion:hello:hello_fileld/>  

this way work fine to me.
Reply to me if you have any better idea wink

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel , Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : www.ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Translations on GitHub