Comments (19)
Insert directly into db:
$widget = ORM::factory('widget'); $widget->name = 'blog/recent'; //name must be unique $widget->title = 'Recent Blogs'; $widget->module = 'blog'; $widget->save();
Create a class extends widget class:
classes/widget/blog.php
class Widget_Blog extends Widget { public function info() { } public function form() { } public function save( array $post ) { //Message::debug( Debug::vars($post) ); } public function delete( array $post ) { } public function render() { switch($this->name) { case 'recent': return $this->recent_blogs($this->widget); break; case 'popular': return $this->blog($this->widget); break; default: return; } } public function recent_blogs($widget) { // Dont show the widget on edit or delete actions. if( Request::current()->action() == 'edit' OR Request::current()->action() == 'delete' ) return false; $blogs = ORM::factory('blog') ->where('status', '=', 'publish') ->order_by('created', 'DESC') return View::factory('blog/widget/list')->set('posts', $blogs); } }
from cms.
For static widgets, you can add directly from admin/widgets/add
from cms.
This exists in Wiki?
from cms.
need to add in wiki. Thanks for pointing it. Same thing with ACL as well.
from cms.
assign me please (with needed rights)
from cms.
Let me check about rights on how to assign rights etc..
from cms.
GitHub Wikis are the simplest way to let others contribute content. Any GitHub user can create and edit pages to use for documentation, examples, support or anything you wish.
from cms.
@sandeepone I think I'm having problems with the widgets ... Can you give a more detailed example?
from cms.
Please explain your problem, show the code.. it would be easy for me
from cms.
Here is the order of my actions:
1. Inserted directly into db:
$widget = ORM::factory('widget');
$widget->name = 'post/recent';
$widget->title = 'Recent Postss';
$widget->module = 'post';
$widget->save();
2. Created a class /modules/gleez/classes/widget/post.php with the following content:
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Widget_Post extends Widget {
public function info(){}
public function form(){}
public function save(array $post){}
public function delete(array $post){}
public function render()
{
switch($this->name)
{
case 'recent':
return $this->get_recent_posts($widget);
break;
default:
return;
}
}
public function get_recent_posts($widget)
{
if(Request::current()->action() == 'edit' OR Request::current()->action() == 'delete')
{
return FALSE;
}
$posts = ORM::factory('post')
->where('status', '=', 'publish')
->order_by('created', 'DESC');
return View::factory('widgets/posts/list')
->set('posts', $posts);
}
}
3. Created a view /modules/gleez/views/widgets/post/list.php:
<?php defined("SYSPATH") OR die("No direct script access.");?>
<p>
Hello world! <!-- nothing happens -->
</p>
<?php
echo Debug::vars(posts); // nothing happens
?>
4. Go to address localhost/admin/widgets
5. Enabled widget (yes, there, in the list of widgets, it appears)
nothing happens...
P.S. I use my personal theme, but it is designed in the likeness fluid with small changes. The log journal there is nothing worthy of attention.
from cms.
so, that with this? :(
from cms.
Sorry for being late replies. I returned from vacation today. The code seems correct, i'll run the code and test to see why it's not working.
@sergeyklay please send any important pull requests, i'm working on pushing lot of changes, so manual merge is needed.
from cms.
I really hope that we will solve this problem..
from cms.
Sorry for delaying.. Doing some code cleanup.. will do it today itself..
from cms.
Hope the issue fixed. Can i close this here??
from cms.
Yes, Thanks! For edit/update the documentation on the wiki, we will create a separate issue
from cms.
@sandeepone You can close this here. I'm created https://github.com/gleez/cms/wiki/Widgets
also see https://github.com/gleez/cms/wiki
from cms.
what with this?
from cms.
Good job. 👍
from cms.
Related Issues (20)
- Theme issue
- Getting client locale at bootstrap time throws exception
- Fix copyright char
- Page shutted down while 403
- Logged in as admin, /admin/menus causes 403
- Maintenance issue (Error 503)
- ErrorException [ Warning ]: array_keys() expects parameter 1 to be array, boolean given HOT 4
- The demo website is out HOT 1
- Stored XSS via blog HOT 1
- CSRF Vulnerability Discovered HOT 2
- XSS Vulnerability caused by Redactor 3 HOT 3
- Stored XSS in profile page HOT 2
- There is a XSS vulnerability that can execute javascript HOT 1
- There is a CSRF vulnerability that can add the administrator account
- There is a CSRF vulnerability that can add the administrator account HOT 2
- Insecure Direct Object Reference - View other user profiles HOT 3
- Unauthenticated user enumeration and Possible account brute force leading to account compromise
- Application is vulnerable to clickjacking attack
- There was an error in the local installation, just like the demo you provided.
- Server-side request forgery (SSRF) vulnerability
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 cms.