info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&offset='+$newoffset);\" >View more</a>";
<?php
if (isset($vars['items']) && is_array($vars['items'])) {
$i = 0;
if (!empty($vars['items'])) {
foreach($vars['items'] as $item) {
echo elgg_view_river_item($item);
$i++;
if ($i >= $vars['limit']) {
break;
}
}
}
}
if ($vars['pagination'] !== false) {
$baseurl = $_SERVER['REQUEST_URI'];
$nav = '';
if (sizeof($vars['items']) > $vars['limit']) {
$newoffset = $vars['offset'] + $vars['limit'];
$nexturl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&offset='+$newoffset);\" >Ver mas</a>";
}
if ($vars['offset'] > 0) {
$newoffset = $vars['offset'] - $vars['limit'];
if ($newoffset < 0) {
$newoffset = 0;
}
$prevurl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&display=friends'+$('input#display').val() + '&content=' + $('select#friends').val()+'&offset='+$newoffset);\" >Ver mas</a>";
}
if (!empty($nav)) {
echo '<div class="river_pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
}
}
?>
<div id="loader"></div>
¿Dónde poner el código ? riverdashboard/index.php ?
nice idea
poner el codigo en list.php
es una demostracion si alguien tiene la capasidad de hacerlo plugin
$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&offset='+$newoffset);\" >Ver mas</a>";
English: put the code in list.php
@mariano share with us the entire code in list.php and may be some screenshots. We could add this to a riverdasboard plugin?
Great idea mariano.
lo puedes ver en facebook cuando bajas el scrollbar y se cargan mas actividades de tus amigos o en mi pagina pero en mi pagina no logro hacerlo funcionar bien
is a great idea to others that the site becomes much more dynamic and do not makemany calls to the server.
si la verdad que si una gran idea
cambiarioa mucho la forma de ver elgg
yes please share all the code. This could be the solution to my river_controls expansion to hide items.
English: You can see it in facebook when you scroll down
Ok, so bottom line, your code doesn't work?
Spanish: El codigo que has puesto no funciona?
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
<?php
/**
* Load more posts
*/
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
$oldest_post_guid = get_input('oldest');
$page_type = get_input('type');
$param = get_input('param');
if (!$oldest_post_guid || !$page_type) {
header('HTTP/1.0 304 Not Modified');
exit;
}
// once we switch over to using guids completely this won't be necessary
$reference_post = get_entity($oldest_post_guid);
switch ($page_type) {
case 'world':
$wire_posts = elgg_get_entities(array(
'type' => 'object',
'subtype' => 'all',
'limit' => 20,
'created_time_upper' => $reference_post->time_created - 1,
));
break;
case 'user':
$wire_posts = get_user_objects($param, '', 20, 0, 0, $reference_post->time_created - 1);
break;
case 'following':
$wire_posts = get_user_friends_objects($param, '', 20, 0, 0, $reference_post->time_created - 1);
break;
case 'search':
$wire_posts = '';
break;
default:
break;
}
$data = array();
$data['html'] = "";
$data['more'] = false;
if (!is_array($wire_posts)) {
echo json_encode($data);
exit;
}
foreach ($wire_posts as $post) {
$data['html'] .= elgg_view_entity($post, true);
$data['guid'] = $post->guid;
if (count($wire_posts) == 20) {
$data['more'] = true;
}
}
echo json_encode($data);
@mariano Escriba código en? views/default/river/item/list.php
<?php
if (isset($vars['items']) && is_array($vars['items'])) {
$i = 0;
if (!empty($vars['items'])) {
foreach($vars['items'] as $item) {
echo elgg_view_river_item($item);
$i++;
if ($i >= $vars['limit']) {
break;
}
}
}
}
if ($vars['pagination'] !== false) {
$baseurl = $_SERVER['REQUEST_URI'];
$nav = '';
if (sizeof($vars['items']) > $vars['limit']) {
$newoffset = $vars['offset'] + $vars['limit'];
$nexturl = elgg_http_add_url_query_elements($baseurl, array('offset' => $newoffset));
$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&offset='+$newoffset);\" >Ver mas</a>";
//$nav .= "<a id=\"postit\" class=\"back\" onclick=\"start()" >Ver mas</a>";
//$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?type=&display=all&content=&callback=false&offset=$newoffset');\" >Ver mas</a>";
//$nav .= "<a id=\"postit\" class=\"back\" onclick=\"$('.river_pagination ').load('?callback=false&display='+$('input#display').val() + '&content=' + $('select#content').val()+'&offset='+$newoffset);\" >Ver mas</a>";
}
if ($vars['offset'] > 0) {
$newoffset = $vars['offset'] - $vars['limit'];
if ($newoffset < 0) {
$newoffset = 0;
}
}
if (!empty($nav)) {
echo '<div class="river_pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
}
}
?>
That code dosen't work as intended and the list.php that is in the elgg core performs better than this code. Your code renders the river list with a next button at the bottom. when clicking that button a window opens below the first page and in that window displays the next page. always leaving the first page in view. There is still a stacking problem.
yes
<?php
/**
* Load more posts
*/
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
$oldest_post_guid = get_input('oldest');
$page_type = get_input('type');
$param = get_input('param');
if (!$oldest_post_guid || !$page_type) {
header('HTTP/1.0 304 Not Modified');
exit;
}
// once we switch over to using guids completely this won't be necessary
$reference_post = get_entity($oldest_post_guid);
switch ($page_type) {
case 'world':
$wire_posts = elgg_get_entities(array(
'type' => 'object',
'subtype' => 'thewire',
'limit' => 20,
'created_time_upper' => $reference_post->time_created - 1,
));
break;
case 'user':
$wire_posts = get_user_objects($param, 'thewire', 20, 0, 0, $reference_post->time_created - 1);
break;
case 'following':
$wire_posts = get_user_friends_objects($param, 'thewire', 20, 0, 0, $reference_post->time_created - 1);
break;
case 'search':
$wire_posts = '';
break;
default:
break;
}
$data = array();
$data['html'] = "";
$data['more'] = false;
if (!is_array($wire_posts)) {
echo json_encode($data);
exit;
}
foreach ($wire_posts as $post) {
$data['html'] .= elgg_view_entity($post, true);
$data['guid'] = $post->guid;
if (count($wire_posts) == 20) {
$data['more'] = true;
}
}
echo json_encode($data);
solo funciona en thewall pero no en el riverdashboard alguna idea