Changeset 610

Show
Ignore:
Timestamp:
10/03/06 18:58:17 (2 years ago)
Author:
ben
Message:

Two new templates have been added, for the main index when a user is logged in, and the main index when the user is logged out. More special keywords are to follow to allow for more Elgg.net style frontpage functionality.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/index.php

    r297 r610  
    11<?php 
    22 
     3    global $CFG; 
     4 
    35    require_once(dirname(__FILE__)."/includes.php"); 
    4     templates_page_setup();     
     6    templates_page_setup(); 
    57    if (logged_on) { 
    6         $body = run("content:mainindex"); 
     8        $body = templates_draw(array( 
     9                                        'context' => 'frontpage_loggedin' 
     10                                )    
     11                                ); 
    712    } else { 
    8         $body = run("content:mainindex:loggedout"); 
     13        $body = templates_draw(array( 
     14                                        'context' => 'frontpage_loggedout' 
     15                                )    
     16                                ); 
    917    } 
    1018     
    1119    echo templates_page_draw( array( 
    12                     sitename, 
     20                    $CFG->sitename, 
    1321                    templates_draw(array( 
    1422                                                    'body' => $body, 
  • devel/lib/templates.php

    r573 r610  
    4848    $template['pageshell'] = file_get_contents($CFG->templatesroot . "Default_Template/pageshell"); 
    4949 
     50    $template['frontpage_loggedout'] = file_get_contents($CFG->templatesroot . "Default_Template/frontpage_loggedout"); 
     51    $template['frontpage_loggedin'] = file_get_contents($CFG->templatesroot . "Default_Template/frontpage_loggedin"); 
     52     
    5053    // REMOVED stylesheet (was old version and should not have been here) 
    5154    // TODO: extract all default template stuff from lib/templates.php 
     
    11281131            } 
    11291132            break; 
    1130  
     1133        case "name": 
     1134            if (logged_on) { 
     1135                return htmlspecialchars($_SESSION['name'], ENT_COMPAT, 'utf-8'); 
     1136            } else { 
     1137                return gettext("Guest"); 
     1138            } 
     1139            break; 
    11311140        case "userfullname":     
    11321141            if (logged_on) { 
     
    12061215 
    12071216            break; 
     1217             
     1218        case 'randomusers': 
     1219            $result = ""; 
     1220            if ($users = get_records_sql("SELECT DISTINCT u.*,i.filename AS iconfile, ".$db->random." as rand  
     1221                                    FROM ".$CFG->prefix."tags t JOIN ".$CFG->prefix."users u ON u.ident = t.owner 
     1222                                    LEFT JOIN ".$CFG->prefix."icons i ON i.ident = u.icon  
     1223                                    WHERE t.tagtype IN (?,?,?) AND u.icon != ? AND t.access = ? AND u.user_type = ?  
     1224                                    ORDER BY rand LIMIT 3",array('biography','minibio','interests',-1,'PUBLIC','person'))) { 
     1225                foreach($users as $key => $user) { 
     1226                    if ($key > 0) { 
     1227                        $result .= ", "; 
     1228                    } else { 
     1229                        $result .= " "; 
     1230                    } 
     1231                    $result .= "<a href=\"" . url . $user->username . "/\">" . stripslashes($user->name) . "</a>"; 
     1232                } 
     1233            } 
     1234            return $result; 
     1235            break; 
     1236             
    12081237        } 
    12091238    }