Jump to content

links getting extraneous link information using templates


azunoman

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.