I have the external pages plugin working in conjunction with the custom_index plugin and would like to add a few other plugins to my custom_index page. How do I simply add Recent Polls, the Wire, and Recent Photos to it. I'd like to make the site a little more interactive on the home page. How do I add these widgets to the index page???
Thanks in advance
- Steve
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.
- Gumba@Gumba
Gumba - 0 likes
- Gumba@Gumba
Gumba - 0 likes
- Trajan@Trajan
Trajan - 0 likes
- Gumba@Gumba
Gumba - 0 likes
- Mike Zacher (vazco)@vazco
Mike Zacher (vazco) - 0 likes
- Gumba@Gumba
Gumba - 0 likes
- Gumba@Gumba
Gumba - 0 likes
- Mike Zacher (vazco)@vazco
Mike Zacher (vazco) - 0 likes
- Gumba@Gumba
Gumba - 0 likes
- Gumba@Gumba
Gumba - 0 likes
You must log in to post replies.Can any help, I'd really like to add the latest videos and latest wire posts, any help would be appreciated
I found the index page I need to modify, but everytime I edit it, the home page gets and error.
File to modify:
mod/custom_index/views/default/canvas/layouts/new_index.php
you also need to edit mod/custom_index/index.php
Thanks for the help Trajan, I really appreciate it.
Any additional help with scripting for the specific plugins: thewire, videolist, polls, tidypics, etc. would be appreciated. I can't seem to get a grip on what to use in place of "blog" or "blogs" below. Keep getting errors. Something isn't working right.
For example here's what I'm trying to add for a POLL widget
INDEX PAGE:
<?php
/**
* Elgg custom index
*
* @package ElggCustomIndex
*/
// Get the Elgg engine
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
//get required data
set_context('search');//display results in search mode, which is list view
//grab the latest 4 blog posts. to display more, change 4 to something else
$blogs = elgg_list_entities(array('type' => 'object', 'subtype' => 'blog', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
//grab the latest bookmarks
$bookmarks = elgg_list_entities(array('type' => 'object', 'subtype' => 'bookmarks', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
//grab the latest files
$files = elgg_list_entities(array('type' => 'object', 'subtype' => 'file', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
//get the newest members who have an avatar
$newest_members = elgg_get_entities_from_metadata(array('metadata_names' => 'icontime', 'types' => 'user', 'limit' => 10));
//newest groups
$groups = elgg_list_entities(array(type => 'group', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
//grab the login form
$login = elgg_view("account/forms/login");
//grab the latest 4 polls
$polls = elgg_list_entities(array('type' => 'object', 'subtype' => 'polls', 'limit' => 4, 'full_view' => FALSE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
//display the contents in our new canvas layout
$body = elgg_view_layout('new_index',$login, $files, $newest_members, $blogs, $groups, $bookmarks, $polls);
page_draw($title, $body);
?>
NEW INDEX:
<?php
/**
* Elgg custom profile
* You can edit the layout of this page with your own layout and style. Whatever you put in the file
* will replace the frontpage of your Elgg site.
*
* @package Elgg
*/
?>
<div id="custom_index">
<!-- left column content -->
<div id="index_left">
<!-- welcome message -->
<div id="index_welcome">
<?php
if (isloggedin()){
echo "<h2>" . elgg_echo("welcome") . " ";
echo $vars['user']->name;
echo "</h2>";
}
?>
<?php
//include a view that plugins can extend
echo elgg_view("index/lefthandside");
?>
<?php
//this displays some content when the user is logged out
if (!isloggedin()){
//display the login form
echo $vars['area1'];
echo "<div class=\"clearfloat\"></div>";
}
?>
</div>
<?php
if(is_plugin_enabled('file')){
?>
<!-- display latest files -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:files"); ?></h2>
<?php
if (!empty($vars['area2'])) {
echo $vars['area2'];//this will display files
}else{
echo "<p><?php echo elgg_echo('custom:nofiles'); ?></p>";
}
?>
</div>
<?php
}
if(is_plugin_enabled('groups')){
?>
<!-- display latest groups -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:groups"); ?></h2>
<?php
if (!empty($vars['area5'])) {
echo $vars['area5'];//this will display groups
}else{
echo "<p><?php echo elgg_echo('custom:nogroups'); ?>.</p>";
}
?>
</div>
<?php
}
?>
</div>
<!-- right hand column -->
<div id="index_right">
<!-- more content -->
<?php
//include a view that plugins can extend
echo elgg_view("index/righthandside");
?>
<!-- latest members -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:members"); ?></h2>
<div class="contentWrapper">
<?php
if(isset($vars['area3'])) {
//display member avatars
foreach($vars['area3'] as $members){
echo "<div class=\"index_members\">";
echo elgg_view("profile/icon",array('entity' => $members, 'size' => 'small'));
echo "</div>";
}
}
?>
<div class="clearfloat"></div>
</div>
</div>
<?php
if(is_plugin_enabled('blog')){
?>
<!-- latest blogs -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:blogs"); ?></h2>
<?php
if (isset($vars['area4']))
echo $vars['area4']; //display blog posts
?>
</div>
<?php
if(is_plugin_enabled('polls')){
?>
<!-- latest polls -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:polls"); ?></h2>
<?php
if (isset($vars['area4']))
echo $vars['area4']; //display polls
?>
</div>
<?php
}
if(is_plugin_enabled('bookmarks')){
?>
<!-- display latest bookmarks -->
<div class="index_box">
<h2><?php echo elgg_echo("custom:bookmarks"); ?></h2>
<?php
if (isset($vars['area6']))
echo $vars['area6']; //display bookmarks
?>
</div>
<?php
}
?>
</div>
<div class="clearfloat"></div>
</div>
Gumba, you may look at this plugin for code of mainpage widgets.
Yeah the script from this plugin really isn't helping much, guess I'll have to dig deeper , thanks for the help though Mike
This is really getting to me, it seems like it would be so easy to add the plugins to the custom_index page without any problem. What am I doing wrong?
Gumba, you can try using this code from vazco_mainpage:
<?php
if (is_plugin_enabled('poll')){
$limit = get_plugin_setting('polls_num_items','vazco_mainpage');
if (!$limit)
$limit = 3;
$_REQUEST['poll_widget'] = 1;
$context = get_context();
$polls_fullview = get_plugin_setting('polls_fullview','vazco_mainpage');
$fullview = false;
if ($polls_fullview == 'yes' && isloggedin())
$fullview = true;
if ($fullview){
set_context('poll');
}else{
set_context('search');
}
$offset = 0;
$polls = get_entities('object','poll',0,'time_created desc',$limit,$offset,false,0);
$count = get_entities('object','poll',0,'time_created desc',999,0,true);
if ($fullview){
$pollsNew = array();
foreach ($polls as $poll){
$priorVote = checkForPreviousVote($poll, get_loggedin_userid());
if (!$priorVote){
$poll->priorVote = $priorVote;
array_push($pollsNew,$poll);
}
}
$polls = $pollsNew;
}
$pollList = "";
foreach ($polls as $poll){
$pollList .= elgg_view('vazco_mainpage/polls/poll',array('entity' => $poll, 'showUser' => false));
}
set_context($context);
?>
<div class="index_box">
<h2><?php echo elgg_echo("custom:poll"); ?></h2>
<div class="contentWrapper">
<?php echo $pollList;?>
<div class="clearfloat"></div>
</div>
</div>
<?php } ?>
This code is compatible with one of the polls plugins (there are two of them).
thanks again mike, I really appreciate your help. After closer inspection I see this code is directly related to vazco plugin. I'd rather stick with the custom_index setup, I really like using the external pages and it's simplicity.
I'm assuming all I need to do is modify the following pages... but I'm missing something here
mod/custom_index/views/default/canvas/layouts/new_index.php
mod/custom_index/index.php
Still trying to get a grasp on how this works. Thanks again for all your help
topic moved to http://community.elgg.org/mod/groups/topicposts.php?topic=683692&group_guid=179063
please close