Welcome Guest, Not a member yet? Register   Sign In
Template Library Version 1.4.1
#11

[eluser]Milos Dakic[/eluser]
Colin I would also be interested in the idea of a "minifier" plug-and-play solution. Would come in most handy as the company I'm working for is looking to restructure their system, and the possibility of using CI is very high, which would include your Template library as it has a plug-and-play system that integrates Smarty.

Keep us posted please Smile
#12

[eluser]Milos Dakic[/eluser]
On another note just found this link: http://www.artofscaling.com/css-minifier/

Might be something to look into.
#13

[eluser]codeninja[/eluser]
Quick question for you. I really love the template library that you have but I am wondering how can I make the header and footer dynamic? I want to display certain sections in the header and footer of the page.

I dont' want the current controller being called to render the header and footer as well. Is there a way to automatically call a certain view/controller to render header and footer?

thanks
#14

[eluser]Randy Casburn[/eluser]
Colin,

This time my question is directly relevant to Templating! ;-)

The concept of add_region() is so fundamentally brilliant, and brilliantly simple it is astounding. That one method could allow modularity through simplicity like CI has not seen before. I know you realize this because you've discussed it in so many threads. I've just now grasped your vision. So here is my next question...

Will you consider adding a parameter to add_region()? That parameter would be $before=null if(null) then drop on the end of the stack, otherwise insert region in stack before $before.

That would provide us finer grained control over the output...and create a modularize application development environment. We don't need HMVC if we have a simple template driver that allows us to insert content dynamically into the view.

The simplicity here makes this a very approachable solution that is easy to understand, adopt and implement.

What say you? It's on a hand full of LOCs.

Randy
#15

[eluser]codeninja[/eluser]
Randy: Can you explain a bit more about add_region() function? I am not sure if i understood it after reading the documentation.

An example would be nice Smile
#16

[eluser]Randy Casburn[/eluser]
Here's what I was thinking...I wrote a class to over ride Colin's class while he decides if this is something he would like to pursue. Here is a replacement for add_region():

Code:
/**
    * Dynamically add region to the currently set template
    *
    * @access  public
    * @param   string   Name to identify the region
    * @param   array  Optional array with region defaults
    * @param   string Optional string region name to deposit this new region before in stack
    * @return  void
    */
  
   function add_region($name, $props = array(), $before = null)
   {
      if ( ! is_array($props))
      {
         $props = array();
      }
      if ( ! isset($this->regions[$name]))
      {
          if ( $before === null)
          {
             $this->regions[$name] = $props;
          }
          else
          {
             $pos = array_search($before,array_keys($this->regions));
             $this->regions = array_merge(array_slice($this->regions,0,$pos), array( $name => $props ), array_slice($this->regions,$pos));
          }
      }
      else
      {
         show_error('The "'. $name .'" region has already been defined.');
      }
   }

Now with this, you can dynamically add regions just like Colin has provided. But with the additional parameter you can place the regions in the array stack relevant to where it shows up on the page. (it could be argued that with CSS this is a moot point.)

So now you could add widgets to your left panel, right panel, footer, header, banner, change you content region into a paneled region etc. This becomes relevant when thinking about user roles and access rights. Logically, you now can dynamically add and remove regions based upon the access rights of the person logged in.

You get the idea.

To implement this, the call would look like this:

Code:
$this->template->add_region('myNewRegion','','footer');

This would add a new region in output page (in the regions stack) above the footer.

Hope the explains what I meant.

Randy
#17

[eluser]Randy Casburn[/eluser]
Colin if you want to PM me about where I'm headed with this, please feel free. You're likely to be miles ahead of me, but I would like to open the door none the less.

Randy
#18

[eluser]Référencement Google[/eluser]
A quick question to you, not related to your template class but more of CI.

About: "Renamed the Template class to CI_Template. This means Template can be replaced/overloaded like core CI classes, and also allows you to have a template.php controller."

This mean I can overide your library using a MY_Template.php file, right? Out of this point, what are the benefits to have a library as a core class?
#19

[eluser]Randy Casburn[/eluser]
@Too pixel - This is not my question to answer, but I'm confused my this wording...

Quote:what are the benefits to have a library as a core class?

Do you mean like the Exception class, or Controller class, or Hooks class, etc? These are all libraries that exist as core classes.

It would seem the naming convention simply provides flexibility. In the last few posts you've seen where I've overridden Colin's work. His use of names simply made this easier and made the conventional use of CI 'feel' more like CI.

Where they go and what they are called is just a symantic game maybe?

Randy
#20

[eluser]Référencement Google[/eluser]
No I don't mean those already existing core libs, I was meaning about creating new libs using CI_Someclass.

I was just wondering because I discovered thanks to Colin's library that I can use CI_Someclass to name my libs if I want them to be part of CI's Core. I missed that point on CI user guide, so I would just like to know what benefits can be.




Theme © iAndrew 2016 - Forum software by © MyBB