Since the question on how exactly to make a custom front page popped up quite often now, here's the code I have made for my own install. You'll still have to modify it a bit.
Let me know if there are any problems!
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.
You absolute legend - thank you!
Does this keep the login on the main page?
This basically gives you a blank frontpage. You'll have to edit content.php to fill it, Aaron.
Thank-You
Thanks for sharing this. I'm sure i'll have more questions.
Thanks for this traveljunkie.
Could you give us an example of a contents.php file, one that pulls some stuff out of the elgg database (for instance, the latest users, activity, etc.)?
You said:
There are a lot more things you can do, like setting a page title or changing the layout from one column to two columns, but that's up to you. These files are basically what I am using on my site, not including the scripts and styles.
I noticed in the index.php that you have:
// Format
$body = elgg_view_layout('one_column', $area1);
I'm assuming this somehow correlates with what someone would place in contents.php, right?
I guess what I need is an understanding of how what's in the contents.php file correlates to the index.php file, and how to put useful things into the contents.php.
Sorry if any of what I am saying appears silly. I suppose I learn best from examples.
And last but not least, how do you disable the plugin if you enabled it without first creating a contents.php file (like I did... lol).
Regards,
sr123
$area1 is the content you put into contents.php. that $body bit tells elgg to take that $area1 and put it into the one_column layout. So whatever you put into contents.php will automatically be put in between the header and the footer.
As for an example... This would get you the latest 36 site members:
This puts the login form on your frontpage:
And this here gets you the latest 12 items of the site activity
Of course you'll still need to add the php tags around these examples and package it all up nicely in some divs and present it with some css to the world.
Hmm, did you try deleting the plugin? That should work. If not, then just copy that login form into contents.php, load it up, log in and deactivate...
Hope that helps...
hi thanks for this plugin!
I managed to override the dashboard also with your plugin!
But I have one question: how do you set the two columns display?
I have put that:
One more question: can someone tell me how to NOT display the login form once the user is logged in?
thanks.
Once I've finished, I'll put my theme on the site.
I managed to customize as I wanted the page but I have another problem:
I tried to put your code to show the members but it is not right apparently a problem with
I put that instead, it is workign but i dont have the dropping menu on the icon (it is at the other side of the div)
you can see it here:
http://etudiants.sciencespoaix.com/
if someone can help me it would be great!
Is there a list of all the functions to call (like the last files etc...) ?
Yeah. That code should read "<div class=\"member_icon\">". Seems like a copy'n'paste error to me. No idea where those extra quotes came from...
You can't use this plugin to change the dashboard. Instead make a new plugin, name it customdash and put this in start.php:
Then adjust content.php accordingly...
thanks.
I was not sure of the syntax.
However, it seems that my start.php fo customindex can override the dashboard!
It is working, the only thing that is not right is the login form which is not disappearing (what is the syntax to check if the user is logged in? , if so i want to display a text instead of the form.
Quentinn, just make it a new plugin. It'll be easier. Right now you're using the same page as your index page and your dashboard. Having a plugin for each will give you greater control.
If you really want to keep it in the same plugin then the above code should do the trick
cany you give me a hint to get a view like http://community.elgg.org/mod/groups/topicposts.php?topic=3786&group_guid=761
??
I'd like to include the cool DIY Map on the index of my site and am having a hard time getting it to show up. Wondering if you have any advice. The DIY Map website instructs the insertion of the code below in order to embed the map. Two files are called: the map file (eg world.swf) and the data file (eg world.eml). Given the embed code I've pasted below, how would you integrate these on the index page?
A second question refers to a problem raised by another commenter and solved before you could respond. How do I keep the 2 column left sidebar layout and use the larger, right-hand column for the contents file?
OK ... I've been able to get the embed code to work but I'm still having trouble calling up the two necessary files. I've styled the div to show where the map ought to show up. You can see what I've got so far here. Any suggestions?
done ... not pretty just yet but working.
check it out at the link above.
Hello, I would like to have an home page that looks like a magazine by show latest admin's blog post, a login form, recent activities and a list of members....how can I do that?
Thanks!
Hello, thanks for the plugin.
In yout introduction you speak of converting the start page to a two column page... since I'm new to Elgg, can you show me (us) how this is done?
Thanks in advance
Biobak
ok. This is the code that I decided to use to create my custom index page however, the page comes up blank. it's not pulling the code. What am I doing wrong???
ok. this is the code that I have decided to use to configure my index page however, it gives me a blank page. what could I be doing wrong?
<?php
/**
* Elgg customindex plugin
* This plugin substitutes the frontpage with a custom one
*
* @package Customdash
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Boris Glumpler
* @copyright Boris Glumpler 2008
* @link /travel-junkie.com
*/
// Put your content below
/**This is the section that should create the login and welcome box*/
<div id="welcome-box">
<div id="login-box">
<?php
$form_body = "<p><label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . "</label><br />";
$form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . "</label><br />";
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . "</p>";
$form_body .= "<p><a href=\"". $vars['url'] ."account/register.php\">" . elgg_echo('register') . "</a> | <a href=\"". $vars['url'] ."account/forgottn_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login"));
?>
</div>
<h2>Welcome to my social website</h2>
<p>This is where my text will go in the txt box...blah blah blah....</p>
</div>
/**This is the section that should show the newest members*/
<div id="newest-members">
<h2>Newest Members</h2>
<?php
$users = get_entities('user', '', 0, '', 25, 0, false, 0, null);
if($users){
foreach($users as $user){
echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'small')) . "</div>";
}
}
?>
</div>
/**This is the section that should show the latest-groups*/
<div id="latest-groups">
<h2>Latest Groups</h2>
<?php
$groups = get_entities('group', '', 0, '', 25, 0, false, 0, null);
if($groups){
foreach($groups as $group){
echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $group, 'size' => 'small')) . "</div>";
}
}
?>
</div>
/**This is the section that should show the latest-activity*/
<div id="latest-activity">
<h2>Latest Activity</h2>
<?php
set_context('search');
$content = list_registered_entities(0,12,true,false,array('object','group'));
$content = elgg_view_layout('', '', $title . $content);
echo $content;
?>
</div>
Hello traveljunkie,
I'm brand new here. (from Holland) I hope to get some help from you people. Few days ago I downloaded Elgg v.1.1 and it seems to be really new so not much, if not nothing, is written about this new version.
Does any of you know what page(s) I need to edit to change the frontpage (shown to visitors before logging on). The items on this issue are not helping me at all. I can not find a /customindex/directory/ and the welcome.php is not working. For all I know my frontpage just occured on my screen after installing.
The script is working fine, as far as I can tell. (http://www.carnut.nl)
Kind regards,
Rich (HiCR)
@kshelton -
[code]
<div id="welcome-box">
<div id="login-box">
<?php
$form_body = "<p><label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea')) . "</label><br />";
$form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . "</label><br />";
$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . "</p>";
$form_body .= "<p><a href=\"". $vars['url'] ."account/register.php\">" . elgg_echo('register') . "</a> | <a href=\"". $vars['url'] ."account/forgottn_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
echo elgg_view('input/form', array('body' => $form_body, 'action' => "". $vars['url'] ."action/login"));
?>
</div>
<h2>Welcome to my social website</h2>
<p>This is where my text will go in the txt box...blah blah blah....</p>
</div>
/**This is the section that should show the newest members*/
<div id="newest-members">
<h2>Newest Members</h2>
<?php
$users = get_entities('user', '', 0, '', 25, 0, false, 0, null);
if($users){
foreach($users as $user){
echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $user, 'size' => 'small')) . "</div>";
}
}
?>
</div>
/**This is the section that should show the latest-groups*/
<div id="latest-groups">
<h2>Latest Groups</h2>
<?php
$groups = get_entities('group', '', 0, '', 25, 0, false, 0, null);
if($groups){
foreach($groups as $group){
echo "<div class=\"member_icon\">" . elgg_view("profile/icon",array('entity' => $group, 'size' => 'small')) . "</div>";
}
}
?>
</div>
/**This is the section that should show the latest-activity*/
<div id="latest-activity">
<h2>Latest Activity</h2>
<?php
set_context('search');
$content = list_registered_entities(0,12,true,false,array('object','group'));
$content = elgg_view_layout('', '', $title . $content);
echo $content;
?>
</div>
[/code]
You had an open php tag, replace entire content.php with the above.
Hi, could anybody explain me how to build 2 columns?
Thanks
Ok, if you want two columns then just change in index.php this line
to this
Hey thanks for the plugin. I just had a couple questions.
Many thanks for any assistance. This is a great plugin Its just going to take me a little bit to learn it:)