, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > Code Snippets > Greeting & Member Login

FlexCMS Support Forum


Greeting & Member Login
Started February 15, 2007 @ 11:27pm by otter
(This thread is currently Locked) 
otter
Administrator



Posts: 177
 
Greeting & Member LoginFebruary 15, 2007 @ 11:27pm
To add the Greeting and Member Login/Register code to a left or right menu block, simply follow these steps:

1) Create a new block

2) Cut and paste the following code into the Custom Block Contents area:


Code

if ($LoggedIn == 'y') {
$NamePrint = $UserDisplayName.'!</b><br><font size="1" color="'.$Colors['BText'].'"><A HREF="'.$MainURL.'/profile-edit.html" class="BlockColors"><font face="'.$FontFace.'" size="1">Edit Profile</font></A> | <A HREF="'.$MainURL.'/logout.html" class="BlockColors"><font face="'.$FontFace.'" size="1">Logout</font></A><br></font>';
}
else {
$NamePrint = 'Guest!</b><br><font face="'.$FontFace.'" size="1" color="'.$Colors['BText'].'">Already a Member?<br> <A HREF="'.$MainURL.'/login.html" class="BlockColors"><font face="'.$FontFace.'" size="1">Login</font></A> or <a href="'.$MainURL.'/register.html" class="BlockColors">Register</a>.<br></font>';
}

print '<font size="1" color="'.$Colors['BText'].'">
<script language="JavaScript"><!--
var Today = new Date();
var Days = new Array("Sun.","Mon.","Tues.", "Wed.","Thurs.","Fri.","Sat.");
var Months = new Array("January","February", "March","April","May","June","July","August", "September","October","November","December");
var Year = Today.getYear();
if (Year < 1000) { Year += 1900; }
var Day = Today.getDate();
var DateEnding = "th";
if (Day == 1 || Day == 21 || Day == 31) { DateEnding = "st"; }
else if (Day == 2 || Day == 22) { DateEnding = "nd"; }
else if (Day == 3 || Day == 23) { DateEnding = "rd"; }
document.write( Days[Today.getDay()] + ", " + Months[Today.getMonth()] + " " + Day + DateEnding + ", " + Year ); //--></script><noscript></noscript><br><br>
<b><script language="JavaScript"><!--
var Greeting = "Hello";
var Today = new Date();
var CurrentHour = Today.getHours();
if (CurrentHour < 12) { Greeting = "Good Morning"; }
if (CurrentHour >= 12 && CurrentHour < 17) { Greeting = "Good Afternoon"; } if (CurrentHour >= 17) { Greeting = "Good Evening"; } document.write(Greeting); //--></script><noscript>Hello</noscript>, '.$NamePrint.'
</div>';


3) Check the box next to Process PHP Code?

4) Save your block.


ONLINE TRAINING CLASSES FOR FLEXCMS IN MAY: FlexCMS Basics (101), Sat., May, 15, 2010 & FlexCMS Blocks (Mon., May 10, 2010).
 

Last Edit: February 15, 2007 @ 11:28pm by DCSun

(This thread is currently Locked) 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.07406 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS