Welcome Guest, Not a member yet? Register   Sign In
$replaceContent = new jquery('replace') and =& get_instance() confusion!!!
#6

[eluser]xwero[/eluser]
You shouldn't look at the tags as objects, this is one of the reasons the library you CI-ed has so much negative responses. It's too much abstraction for a tag that can be generated using a function.

The tags are just a bunch of strings with the same format. you can write one function to create all xml style tags you need.
Code:
function create_tag($name,$attributes='',$content='',$self_closing = false)
{
   $output = '<'.$name;

   if(! empty($attributes)
   {
      $output .= ' '.$attributes;
   }

   if($self_closing)
   {
      $output .= ' />';
   }
   else
   {
      $output .= '>'.$content.'</'.$name.'>';
   }

   return $output;
}

And you can use this function to create functions that are easier for the developers to use.

But back to your helper now. For the CI-ed class it makes sense to make different objects because they are independent. But your helpers functionality is to create an xml file which means the tags are related.

An example how the creation of your taconite xml file would look with my library
Code:
$this->taconite->open_tag('css')->set('p.important', array('red','blue'))->close_tag('css');
$this->taconite->open_tag('slideUp')->set('div#features ul', 'fast')->close_tag('slideUp');
// ...
$this->taconite->create_xml('path/taconite');
It would be more convenient if the tag creation is just
Code:
$this->taconite->add_tag('slideUp','div#features ul','fast');


Messages In This Thread
$replaceContent = new jquery('replace') and =& get_instance() confusion!!! - by El Forum - 02-24-2009, 06:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB