Code Monkey home page Code Monkey logo

Comments (3)

lonnieezell avatar lonnieezell commented on August 11, 2024

First - glad you're enjoying Ocular. I almost can't imagine working without it anymore. :)

The times I've done things like this, I haven't needed the blocks feature. Instead I've just used CI's standard:

$this->load->view('single_entry', $entries)

And looped inside of the 'single_entry' file.

What you're recommending make sense, though I'm not sure that I see the need to complicate things by having Ocular perform the loop, when a simple PHP (or even a template parser) call will do the trick.

I will add in the ability to pass data to the block, though.

from ocular-template-library.

lonnieezell avatar lonnieezell commented on August 11, 2024

Version 2.13 (available in just a few minutes) includes two items for you:

First: you can now pass an array into the block() method.

Second: A new function, called themed_view(), which acts like a helper function, just like the breadcrumb function. It takes the path to a view, relative to the theme folder, and a data array, then renders the view based on the current theme. This was a function that I needed recently while working on a mobile version of a site where blocks felt too heavy handed.

That should handle most of your needs, right there. Let me know if something broke. I ran some quick tests and everything appears to be working, but you never know. :)

from ocular-template-library.

shaunandrews avatar shaunandrews commented on August 11, 2024

Awesome stuff, Lonnie!

However, the updates to the block don't seem to do what I needβ€”I'm passing an object to the block, but it appears that it will only work with an array. In any event, I took your original advice and use the Loader class to call the view and passing an object. I originally tried this, but was unaware that this ran a PHP extract, and output the object fields as variables, So $object->field becomes $field. Cool stuff.

Again, thanks for the great work!

from ocular-template-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.