Jump to content

Dynamic Page Title With Get


astonishin

Recommended Posts

It pretty simple to get to to work i use the code below to get the title and it works but only on pages that directly includes the header.

 

<title><?= $configs['sitename'];?> - <?php if(isset($page)) { print $page; } else { print "{$configs['slogan']}"; } ?></title>

 

i use the get function to get to a page and the header isn't included on them in my index.php file i call the header footer and the control panel for the GET which calls the page as ?os=etc

Link to comment
Share on other sites

Man, I have no idea what you're asking... from what I understand, you only call the headers in some files, but you want the page title to be visible in all of them, is this correct? Then you answered it yourself: include headers in all pages.

Link to comment
Share on other sites

I still don't quite understand what you're getting at, since you've posted so little code.

html <title> tags must be withing your <head>...</head> section. If you're not including the <head> section on some pages, then it probably won't work.

Link to comment
Share on other sites

below is the code for my index.php there is a small error how can i fix this

 

<?php
    ob_start();
session_start();
<title>$configs['sitename'] - if(isset($page)) { print $page; } else { print "{$configs['slogan']}"; } </title>
include("assets/header.php");

include("assets/action.php");

include("assets/footer.php");

?>

Link to comment
Share on other sites

header

 

<?php
include("includes/functions.php");
require("includes/connect.php");
require_once($_SERVER['DOCUMENT_ROOT'] . '/assets/includes/geoip.inc');
$gi = geoip_open($_SERVER['DOCUMENT_ROOT'] . '/assets/includes/GeoIP.dat',GEOIP_STANDARD);


	$ip = $_SERVER['REMOTE_ADDR'];
	$checkbanned  = mysql_query("select * from banned where ip_addr='$ip'", $c);
	while($reason = mysql_fetch_array($checkbanned))

        if (mysql_num_rows($checkbanned) != 0) {
            header("Location: ?os=banned");

}
//Create cookie if visiter visits referral link
if($_GET['ref']) {
$expire=time()+60*60*24*30;
$ref = $_GET['ref'];
setcookie('ref', $ref, $time);
}
?>


<html>

<head>

<title><?= $configs['sitename'];?> - <?php if(isset($page)) { print $page; } else { print "{$configs['slogan']}"; } ?></title>


	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="robots" content="index,follow" />

	<link rel="stylesheet" type="text/css" href="/assets/css/style.css" media="all" />

</head>

<body>

	<div id="wrapper">
	<?
if ($_GET['ref'] != "") {
    $ref = strip_tags($_GET['ref']);
}
?>
		<div id="header">

			<a href="../?os=home" title="Mucove"><img src="/assets/images/logo.png" alt="Mucove" /></a>

		</div>

		<div id="menu">
		<?

if ($_SESSION['loggedin'] == 1) {
    include "includes/connect.php";
    $signupbutton = "";
$memarea    = "			<li><a href=\"../?os=user\">Members</a></li>";
    $logbutton    = "			<li><a href=\"../?os=logout\">Logout</a></li>";

    $message = "";
    if ($_GET['act'] = "changepaypal" && $_GET['paypal'] != "") {
        $_GET['act'] = strip_tags($_GET['act']);
        $paypal      = $_GET['paypal'];
        $paypal      = str_replace(array(
            "<",
            ">"
        ), array(
            "<",
            ">"
        ), $paypal);
        mysql_query("update users set `paypal`='$paypal' where id={$_SESSION['userid']}", $c);
        $message = "<font color=\"red\">Paypal address updated.</font>";
    }

    $getuser = mysql_query("select * from users where id={$_SESSION['userid']}", $c);
    $ui      = mysql_fetch_array($getuser);
    $ip      = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
    mysql_query("update users set `userIP`='$ip' where id={$_SESSION['userid']}", $c);
    if ($ui['banned'] != "") {
        die("<center><font color=\"red\"><b>Your account has been banned.</b><br>Reason: {$ui['banned']}</font></center>");
    }
} else {
    $signupbutton =  "          <li id=\"$register\"><a href=\"../?os=register\">Register</a></li>";
    $logbutton    = "			<li id=\"$login\"><a href=\"../?os=login\">Login</a></li>";
}

?>	
			<ul>
		<li class="<?= $home; ?>"><a href="../?os=home">Home</a></li>
		<li><a href='../?os=offers'>Offers</a></li>
            <? print "$memarea"; ?>
            <li><a href='../?os=contact'>Contact</a></li>
		<li><a href='../forums.php'>Forum</a></li>	
            <div class="right">	
            <? print "$logbutton"; ?>
		<? print "$signupbutton"; ?>
            </div>   
                </ul>

            
		</div>

		<div class="memstats-container">

        <?

            $get_offers = mysql_query("SELECT * FROM `offers` WHERE active=1", $c);
            $total_offers = mysql_num_rows($get_offers);

            $get_users = mysql_query("SELECT * FROM `users`", $c);  
            $total_users = mysql_num_rows($get_users);   

            while($user = mysql_fetch_array($get_users)) {
                $total_money = $total_money + $user['total_earned'];
            }



            print "
            ";

            if ($_SESSION['loggedin'] == 1) {
            print "

     <span style='padding-left:5px;'><a style='color:#d03434' href='../profile/?do={$ui['username']}'><strong>".$ui['username'].":</strong></a></span>
     <span style='padding-left:5px;color:white'>$".$ui['current_balance']."</span>
     <span style='padding-left:5px;color:white'><a class='button' style='background-color:#6BC219'>Inbox</a><a style='background-color:#c42f2f' class='button' href='#'>+</a></span>
   

            ";
            }

        ?> 
</div>

<?
if ($_SESSION['loggedin'] == 1 && $ui['email_verified'] != 1) {
?>
<center><div class="not-error"> Your email has not been verified.<br>You will not be able to cashout until you do so.</font><br><a href="http://mucove.com/verify.php">Click here to go to the email verification page</a></br></div></center>
<?
}
?>

		<div id="content">

Link to comment
Share on other sites

as I said before, the title tag <title> must be inside your <head> tags.

 

you have one <title> inside header.php (that is also inside <head> tags, so this is correct) then you have a <title> tag lost at the top of your index.php.

 

remove <title> line from index.php.

Link to comment
Share on other sites

i have to use a code like that on the index page in that location to call the meta info how can i do that.

 

I tried the code below but it gives me an error in Dreamweaver.

function openPage( $title )
{
    print "<html>";  // you could also include DOCTYPE declarations here for all your docs.
    print "<head><title>$title</title>";
    print "<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyle.css\">";    
    print "<script language=\"JavaScript\" src=\"javascript/myjs.js\"></script>";  
    print "</head>"
}  

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.