Jump to content

Archived

This topic is now archived and is closed to further replies.

azunoman

links getting extraneous link information using templates

Recommended Posts

I created a template, which is used by each page in my site for consistency.  page1 page2 page3 etc.

Each page has a common class call that will check if the user is logged on etc.  It provides links depending on the status of the user.  The links are fine on the initial page but for each subsequent page the links will be www.mysite.com/login/login/register.php.  It just keeps adding the /login/ folder....argh


[code]echo "Welcome"."[<a href=\"login/login.php\">Sign In</a>]"."&nbsp;&nbsp;"."[<a href=\"login/register.php\">Register</a>]"."&nbsp;&nbsp;";[/code]

There has to be a better method.  What says the forum?

Thanks in advance for your time.

HERE IS THE CLASS CODE I WROTE, USED BY EACH AND EVERY PAGE.
[code]<?
// DisplaySignOnStatus.php
// Called to display signon status
//
require_once $_SERVER['DOCUMENT_ROOT']."/login/include/session.php";
//
//
//
class DisplaySignOnStatus {
function DisplaySignOnStatus(){
global $session;
/* Check if user logged_in */
if($session->logged_in){
echo "Hello <b>$session->username</b>!&nbsp;&nbsp;"."[<a href=\"login/process.php\">Logout</a>]"."&nbsp;&nbsp;"
."[<a href=\"login/userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;";

if($session->isAdmin()){
echo "[<a href=\"login/admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
}
}
//
//user is not logged on
//
else{
echo "Welcome"."[<a href=\"login/login.php\">Sign In</a>]"."&nbsp;&nbsp;"."[<a href=\"login/register.php\">Register</a>]"."&nbsp;&nbsp;";
}
} //end method
}; //class

/* Initialize process */
$signstatus = new DisplaySignOnStatus;
?>

[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.