Comments (3)
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.
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.
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)
- AJAX layouts not correct in repo
- viewing not in the right way... HOT 1
- $bypass always set to FALSE ? HOT 3
- view content echoed before layout content HOT 1
- Controllers in sub-folders HOT 1
- Pass array directly to template->set HOT 2
- Not reverting view loads to default theme. HOT 3
- HMVC HOT 6
- Current View Name Always Displayed HOT 1
- AJAX Layout Not Working HOT 1
- echoing Current View HOT 1
- active_theme
- Session load to use message()
- render helper
- set_message() not clearing
- themed_view()
- 500 Internal Server Error when Template library wants to load config file
- Return layout/view as string rather than render to screen HOT 1
- yield() method conflicts with PHP 5.5+ "yield" keyword HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocular-template-library.